ccjk 3.6.1 → 3.7.2

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.mts CHANGED
@@ -96,52 +96,52 @@ interface ICodeTool {
96
96
  /**
97
97
  * Get tool metadata
98
98
  */
99
- getMetadata(): ToolMetadata;
99
+ getMetadata: () => ToolMetadata;
100
100
  /**
101
101
  * Check if the tool is installed
102
102
  */
103
- isInstalled(): Promise<InstallStatus>;
103
+ isInstalled: () => Promise<InstallStatus>;
104
104
  /**
105
105
  * Install the tool
106
106
  */
107
- install(): Promise<ExecutionResult>;
107
+ install: () => Promise<ExecutionResult>;
108
108
  /**
109
109
  * Uninstall the tool
110
110
  */
111
- uninstall(): Promise<ExecutionResult>;
111
+ uninstall: () => Promise<ExecutionResult>;
112
112
  /**
113
113
  * Get current configuration
114
114
  */
115
- getConfig(): Promise<ToolConfig>;
115
+ getConfig: () => Promise<ToolConfig>;
116
116
  /**
117
117
  * Update configuration
118
118
  * @param updates Partial configuration to update
119
119
  */
120
- updateConfig(updates: Partial<ToolConfig>): Promise<void>;
120
+ updateConfig: (updates: Partial<ToolConfig>) => Promise<void>;
121
121
  /**
122
122
  * Configure the tool with full config
123
123
  * @param config Complete configuration
124
124
  */
125
- configure(config: ToolConfig): Promise<void>;
125
+ configure: (config: ToolConfig) => Promise<void>;
126
126
  /**
127
127
  * Validate configuration
128
128
  * @param config Configuration to validate
129
129
  */
130
- validateConfig(config: Partial<ToolConfig>): Promise<boolean>;
130
+ validateConfig: (config: Partial<ToolConfig>) => Promise<boolean>;
131
131
  /**
132
132
  * Execute a command with the tool
133
133
  * @param command Command to execute
134
134
  * @param args Command arguments
135
135
  */
136
- execute(command: string, args?: string[]): Promise<ExecutionResult>;
136
+ execute: (command: string, args?: string[]) => Promise<ExecutionResult>;
137
137
  /**
138
138
  * Get tool version
139
139
  */
140
- getVersion(): Promise<string | undefined>;
140
+ getVersion: () => Promise<string | undefined>;
141
141
  /**
142
142
  * Reset tool to default configuration
143
143
  */
144
- reset(): Promise<void>;
144
+ reset: () => Promise<void>;
145
145
  }
146
146
  /**
147
147
  * Interface for tools that support chat/conversation
@@ -151,16 +151,16 @@ interface IChatTool extends ICodeTool {
151
151
  * Start a chat session
152
152
  * @param prompt Initial prompt
153
153
  */
154
- chat(prompt: string): Promise<ExecutionResult>;
154
+ chat: (prompt: string) => Promise<ExecutionResult>;
155
155
  /**
156
156
  * Continue a chat session
157
157
  * @param message Message to send
158
158
  */
159
- continueChat(message: string): Promise<ExecutionResult>;
159
+ continueChat: (message: string) => Promise<ExecutionResult>;
160
160
  /**
161
161
  * End chat session
162
162
  */
163
- endChat(): Promise<void>;
163
+ endChat: () => Promise<void>;
164
164
  }
165
165
  /**
166
166
  * Interface for tools that support file editing
@@ -171,13 +171,13 @@ interface IFileEditTool extends ICodeTool {
171
171
  * @param filePath Path to file
172
172
  * @param instructions Edit instructions
173
173
  */
174
- editFile(filePath: string, instructions: string): Promise<ExecutionResult>;
174
+ editFile: (filePath: string, instructions: string) => Promise<ExecutionResult>;
175
175
  /**
176
176
  * Edit multiple files
177
177
  * @param files Array of file paths
178
178
  * @param instructions Edit instructions
179
179
  */
180
- editFiles(files: string[], instructions: string): Promise<ExecutionResult>;
180
+ editFiles: (files: string[], instructions: string) => Promise<ExecutionResult>;
181
181
  }
182
182
  /**
183
183
  * Interface for tools that support code generation
@@ -188,7 +188,7 @@ interface ICodeGenTool extends ICodeTool {
188
188
  * @param prompt Generation prompt
189
189
  * @param outputPath Optional output path
190
190
  */
191
- generateCode(prompt: string, outputPath?: string): Promise<ExecutionResult>;
191
+ generateCode: (prompt: string, outputPath?: string) => Promise<ExecutionResult>;
192
192
  }
193
193
 
194
194
  /**
@@ -294,107 +294,85 @@ declare abstract class BaseCodeTool implements ICodeTool {
294
294
  }
295
295
 
296
296
  /**
297
- * Tool registry for managing code tool instances
297
+ * Aider adapter
298
298
  */
299
299
 
300
300
  /**
301
- * Registry for managing code tool instances
301
+ * Aider tool adapter
302
302
  */
303
- declare class ToolRegistry {
304
- private static instance;
305
- private tools;
306
- private toolClasses;
307
- private constructor();
308
- /**
309
- * Get singleton instance
310
- */
311
- static getInstance(): ToolRegistry;
312
- /**
313
- * Register a tool class
314
- */
315
- registerToolClass(name: string, toolClass: new () => ICodeTool): void;
316
- /**
317
- * Register a tool instance
318
- */
319
- registerTool(tool: ICodeTool): void;
320
- /**
321
- * Get a tool instance by name
322
- */
323
- getTool(name: string): ICodeTool | undefined;
324
- /**
325
- * Get all registered tool names
326
- */
327
- getToolNames(): string[];
303
+ declare class AiderTool extends BaseCodeTool implements IChatTool, IFileEditTool {
304
+ getMetadata(): ToolMetadata;
305
+ protected getInstallCheckCommand(): string;
306
+ protected getInstallCommand(): string;
307
+ protected getUninstallCommand(): string;
328
308
  /**
329
- * Get all tool instances
309
+ * Start a chat session
330
310
  */
331
- getAllTools(): ICodeTool[];
311
+ chat(prompt: string): Promise<ExecutionResult>;
332
312
  /**
333
- * Check if a tool is registered
313
+ * Continue a chat session
334
314
  */
335
- hasTool(name: string): boolean;
315
+ continueChat(message: string): Promise<ExecutionResult>;
336
316
  /**
337
- * Unregister a tool
317
+ * End chat session
338
318
  */
339
- unregisterTool(name: string): void;
319
+ endChat(): Promise<void>;
340
320
  /**
341
- * Clear all registered tools
321
+ * Edit a file
342
322
  */
343
- clear(): void;
323
+ editFile(filePath: string, instructions: string): Promise<ExecutionResult>;
344
324
  /**
345
- * Get metadata for all registered tools
325
+ * Edit multiple files
346
326
  */
347
- getAllMetadata(): Promise<ToolMetadata[]>;
327
+ editFiles(files: string[], instructions: string): Promise<ExecutionResult>;
348
328
  }
349
- /**
350
- * Convenience function to get the registry instance
351
- */
352
- declare function getRegistry(): ToolRegistry;
353
329
 
354
330
  /**
355
- * Factory for creating code tool instances
331
+ * Claude Code adapter
356
332
  */
357
333
 
358
334
  /**
359
- * Factory for creating code tool instances
335
+ * Claude Code tool adapter
360
336
  */
361
- declare class ToolFactory {
362
- private registry;
363
- constructor(registry?: ToolRegistry);
337
+ declare class ClaudeCodeTool extends BaseCodeTool implements IChatTool, IFileEditTool, ICodeGenTool {
338
+ getMetadata(): ToolMetadata;
339
+ protected getInstallCheckCommand(): string;
340
+ protected getInstallCommand(): string;
341
+ protected getUninstallCommand(): string;
364
342
  /**
365
- * Create a tool instance by name
343
+ * Start a chat session
366
344
  */
367
- createTool(name: string, config?: Partial<ToolConfig>): ICodeTool;
345
+ chat(prompt: string): Promise<ExecutionResult>;
368
346
  /**
369
- * Create multiple tool instances
347
+ * Continue a chat session
370
348
  */
371
- createTools(names: string[]): ICodeTool[];
349
+ continueChat(message: string): Promise<ExecutionResult>;
372
350
  /**
373
- * Create all registered tools
351
+ * End chat session
374
352
  */
375
- createAllTools(): ICodeTool[];
353
+ endChat(): Promise<void>;
376
354
  /**
377
- * Check if a tool can be created
355
+ * Edit a file
378
356
  */
379
- canCreateTool(name: string): boolean;
357
+ editFile(filePath: string, instructions: string): Promise<ExecutionResult>;
380
358
  /**
381
- * Get available tool names
359
+ * Edit multiple files
382
360
  */
383
- getAvailableTools(): string[];
361
+ editFiles(files: string[], instructions: string): Promise<ExecutionResult>;
362
+ /**
363
+ * Generate code
364
+ */
365
+ generateCode(prompt: string, outputPath?: string): Promise<ExecutionResult>;
384
366
  }
385
- /**
386
- * Convenience function to create a tool
387
- */
388
- declare function createTool(name: string, config?: Partial<ToolConfig>): ICodeTool;
389
367
 
390
368
  /**
391
- * Claude Code adapter
369
+ * Cline adapter
392
370
  */
393
371
 
394
372
  /**
395
- * Claude Code tool adapter
373
+ * Cline tool adapter
396
374
  */
397
- declare class ClaudeCodeTool extends BaseCodeTool implements IChatTool, IFileEditTool, ICodeGenTool {
375
+ declare class ClineTool extends BaseCodeTool implements IChatTool, IFileEditTool, ICodeGenTool {
398
376
  getMetadata(): ToolMetadata;
399
377
  protected getInstallCheckCommand(): string;
400
378
  protected getInstallCommand(): string;
@@ -443,40 +421,6 @@ declare class CodexTool extends BaseCodeTool implements ICodeGenTool {
443
421
  generateCode(prompt: string, outputPath?: string): Promise<ExecutionResult>;
444
422
  }
445
423
 
446
- /**
447
- * Aider adapter
448
- */
449
-
450
- /**
451
- * Aider tool adapter
452
- */
453
- declare class AiderTool extends BaseCodeTool implements IChatTool, IFileEditTool {
454
- getMetadata(): ToolMetadata;
455
- protected getInstallCheckCommand(): string;
456
- protected getInstallCommand(): string;
457
- protected getUninstallCommand(): string;
458
- /**
459
- * Start a chat session
460
- */
461
- chat(prompt: string): Promise<ExecutionResult>;
462
- /**
463
- * Continue a chat session
464
- */
465
- continueChat(message: string): Promise<ExecutionResult>;
466
- /**
467
- * End chat session
468
- */
469
- endChat(): Promise<void>;
470
- /**
471
- * Edit a file
472
- */
473
- editFile(filePath: string, instructions: string): Promise<ExecutionResult>;
474
- /**
475
- * Edit multiple files
476
- */
477
- editFiles(files: string[], instructions: string): Promise<ExecutionResult>;
478
- }
479
-
480
424
  /**
481
425
  * Continue adapter
482
426
  */
@@ -508,13 +452,13 @@ declare class ContinueTool extends BaseCodeTool implements IChatTool, ICodeGenTo
508
452
  }
509
453
 
510
454
  /**
511
- * Cline adapter
455
+ * Cursor adapter
512
456
  */
513
457
 
514
458
  /**
515
- * Cline tool adapter
459
+ * Cursor tool adapter
516
460
  */
517
- declare class ClineTool extends BaseCodeTool implements IChatTool, IFileEditTool, ICodeGenTool {
461
+ declare class CursorTool extends BaseCodeTool implements IChatTool, IFileEditTool, ICodeGenTool {
518
462
  getMetadata(): ToolMetadata;
519
463
  protected getInstallCheckCommand(): string;
520
464
  protected getInstallCommand(): string;
@@ -546,1818 +490,1916 @@ declare class ClineTool extends BaseCodeTool implements IChatTool, IFileEditTool
546
490
  }
547
491
 
548
492
  /**
549
- * Cursor adapter
493
+ * Tool registry for managing code tool instances
550
494
  */
551
495
 
552
496
  /**
553
- * Cursor tool adapter
497
+ * Registry for managing code tool instances
554
498
  */
555
- declare class CursorTool extends BaseCodeTool implements IChatTool, IFileEditTool, ICodeGenTool {
556
- getMetadata(): ToolMetadata;
557
- protected getInstallCheckCommand(): string;
558
- protected getInstallCommand(): string;
559
- protected getUninstallCommand(): string;
499
+ declare class ToolRegistry {
500
+ private static instance;
501
+ private tools;
502
+ private toolClasses;
503
+ private constructor();
560
504
  /**
561
- * Start a chat session
505
+ * Get singleton instance
562
506
  */
563
- chat(prompt: string): Promise<ExecutionResult>;
507
+ static getInstance(): ToolRegistry;
564
508
  /**
565
- * Continue a chat session
509
+ * Register a tool class
566
510
  */
567
- continueChat(message: string): Promise<ExecutionResult>;
511
+ registerToolClass(name: string, toolClass: new () => ICodeTool): void;
568
512
  /**
569
- * End chat session
513
+ * Register a tool instance
570
514
  */
571
- endChat(): Promise<void>;
515
+ registerTool(tool: ICodeTool): void;
572
516
  /**
573
- * Edit a file
517
+ * Get a tool instance by name
574
518
  */
575
- editFile(filePath: string, instructions: string): Promise<ExecutionResult>;
519
+ getTool(name: string): ICodeTool | undefined;
576
520
  /**
577
- * Edit multiple files
521
+ * Get all registered tool names
578
522
  */
579
- editFiles(files: string[], instructions: string): Promise<ExecutionResult>;
523
+ getToolNames(): string[];
580
524
  /**
581
- * Generate code
525
+ * Get all tool instances
582
526
  */
583
- generateCode(prompt: string, outputPath?: string): Promise<ExecutionResult>;
527
+ getAllTools(): ICodeTool[];
528
+ /**
529
+ * Check if a tool is registered
530
+ */
531
+ hasTool(name: string): boolean;
532
+ /**
533
+ * Unregister a tool
534
+ */
535
+ unregisterTool(name: string): void;
536
+ /**
537
+ * Clear all registered tools
538
+ */
539
+ clear(): void;
540
+ /**
541
+ * Get metadata for all registered tools
542
+ */
543
+ getAllMetadata(): Promise<ToolMetadata[]>;
584
544
  }
585
-
586
- declare const AI_OUTPUT_LANGUAGES: {
587
- readonly 'zh-CN': {
588
- readonly directive: "Always respond in Chinese-simplified";
589
- };
590
- readonly en: {
591
- readonly directive: "Always respond in English";
592
- };
593
- readonly custom: {
594
- readonly directive: "";
595
- };
596
- };
597
- type AiOutputLanguage = keyof typeof AI_OUTPUT_LANGUAGES;
598
-
599
545
  /**
600
- * API configuration for Claude Code
546
+ * Convenience function to get the registry instance
601
547
  */
602
- interface ApiConfig {
603
- url: string;
604
- key: string;
605
- authType?: 'auth_token' | 'api_key';
606
- }
548
+ declare function getRegistry(): ToolRegistry;
607
549
 
608
- declare function ensureClaudeDir(): void;
609
- declare function backupExistingConfig(): string | null;
610
- declare function copyConfigFiles(onlyMd?: boolean): void;
611
- declare function configureApi(apiConfig: ApiConfig | null): ApiConfig | null;
612
- declare function mergeConfigs(sourceFile: string, targetFile: string): void;
613
550
  /**
614
- * Update custom model configuration using environment variables
615
- * @param primaryModel - Primary model name for general tasks
616
- * @param haikuModel - Default Haiku model (optional)
617
- * @param sonnetModel - Default Sonnet model (optional)
618
- * @param opusModel - Default Opus model (optional)
551
+ * Factory for creating code tool instances
619
552
  */
620
- declare function updateCustomModel(primaryModel?: string, haikuModel?: string, sonnetModel?: string, opusModel?: string): void;
553
+
621
554
  /**
622
- * Update the default model configuration in settings.json
623
- * @param model - The model type to set: opus, sonnet, sonnet[1m], default, or custom
624
- * Note: 'custom' model type is handled differently - it should use environment variables instead
555
+ * Factory for creating code tool instances
625
556
  */
626
- declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom'): void;
627
- /**
628
- * Merge settings.json intelligently
629
- * Preserves user's environment variables and custom configurations
630
- */
631
- declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
557
+ declare class ToolFactory {
558
+ private registry;
559
+ constructor(registry?: ToolRegistry);
560
+ /**
561
+ * Create a tool instance by name
562
+ */
563
+ createTool(name: string, config?: Partial<ToolConfig>): ICodeTool;
564
+ /**
565
+ * Create multiple tool instances
566
+ */
567
+ createTools(names: string[]): ICodeTool[];
568
+ /**
569
+ * Create all registered tools
570
+ */
571
+ createAllTools(): ICodeTool[];
572
+ /**
573
+ * Check if a tool can be created
574
+ */
575
+ canCreateTool(name: string): boolean;
576
+ /**
577
+ * Get available tool names
578
+ */
579
+ getAvailableTools(): string[];
580
+ }
632
581
  /**
633
- * Get existing model configuration from settings.json
582
+ * Convenience function to create a tool
634
583
  */
635
- declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom' | null;
584
+ declare function createTool(name: string, config?: Partial<ToolConfig>): ICodeTool;
585
+
636
586
  /**
637
- * Get existing API configuration from settings.json
587
+ * Array Utilities
588
+ * Array manipulation and transformation functions
638
589
  */
639
- declare function getExistingApiConfig(): ApiConfig | null;
640
- declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
641
590
  /**
642
- * Switch to official login mode - remove all third-party API configurations
643
- * Removes: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY from settings.json
644
- * Removes: primaryApiKey from ~/.claude/config.json
591
+ * Remove duplicates from array
645
592
  */
646
- declare function switchToOfficialLogin(): boolean;
593
+ declare function unique<T>(arr: T[]): T[];
647
594
  /**
648
- * Prompt user for API configuration action when existing config is found
649
- * Returns the user's choice for how to handle existing configuration
595
+ * Remove duplicates by key
650
596
  */
651
- declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
652
-
653
- type config_ApiConfig = ApiConfig;
654
- declare const config_applyAiLanguageDirective: typeof applyAiLanguageDirective;
655
- declare const config_backupExistingConfig: typeof backupExistingConfig;
656
- declare const config_configureApi: typeof configureApi;
657
- declare const config_copyConfigFiles: typeof copyConfigFiles;
658
- declare const config_ensureClaudeDir: typeof ensureClaudeDir;
659
- declare const config_getExistingApiConfig: typeof getExistingApiConfig;
660
- declare const config_getExistingModelConfig: typeof getExistingModelConfig;
661
- declare const config_mergeConfigs: typeof mergeConfigs;
662
- declare const config_mergeSettingsFile: typeof mergeSettingsFile;
663
- declare const config_promptApiConfigurationAction: typeof promptApiConfigurationAction;
664
- declare const config_switchToOfficialLogin: typeof switchToOfficialLogin;
665
- declare const config_updateCustomModel: typeof updateCustomModel;
666
- declare const config_updateDefaultModel: typeof updateDefaultModel;
667
- declare namespace config {
668
- export { config_applyAiLanguageDirective as applyAiLanguageDirective, config_backupExistingConfig as backupExistingConfig, config_configureApi as configureApi, config_copyConfigFiles as copyConfigFiles, config_ensureClaudeDir as ensureClaudeDir, config_getExistingApiConfig as getExistingApiConfig, config_getExistingModelConfig as getExistingModelConfig, config_mergeConfigs as mergeConfigs, config_mergeSettingsFile as mergeSettingsFile, config_promptApiConfigurationAction as promptApiConfigurationAction, config_switchToOfficialLogin as switchToOfficialLogin, config_updateCustomModel as updateCustomModel, config_updateDefaultModel as updateDefaultModel };
669
- export type { config_ApiConfig as ApiConfig };
670
- }
671
-
672
- declare function getPlatform$1(): 'windows' | 'macos' | 'linux';
673
- declare function isTermux(): boolean;
674
- declare function getTermuxPrefix(): string;
675
- declare function isWindows$1(): boolean;
676
- interface WSLInfo {
677
- isWSL: true;
678
- distro: string | null;
679
- version: string | null;
680
- }
681
- declare function isWSL(): boolean;
682
- declare function getWSLDistro(): string | null;
683
- declare function getWSLInfo(): WSLInfo | null;
597
+ declare function uniqueBy<T>(arr: T[], key: keyof T | ((item: T) => any)): T[];
684
598
  /**
685
- * Get MCP command with platform-specific wrapper if needed
686
- * @param command - The base command to execute (default: 'npx')
687
- * @returns Command array with Windows wrapper if applicable
599
+ * Flatten nested array
688
600
  */
689
- declare function getMcpCommand(command?: string): string[];
601
+ declare function flatten$1<T>(arr: any[], depth?: number): T[];
690
602
  /**
691
- * Normalize Windows paths by converting backslashes to forward slashes
692
- * This ensures Windows paths like "C:\Program Files\nodejs\npx.cmd" are correctly
693
- * written as "C:/Program Files/nodejs/npx.cmd" in TOML format, avoiding escape issues
694
- * Unified function used by getSystemRoot() and normalizePath() to avoid code duplication
695
- * @param str - The string to normalize (typically a Windows path)
696
- * @returns The normalized string with backslashes replaced by forward slashes
603
+ * Chunk array into smaller arrays
697
604
  */
698
- declare function normalizeTomlPath(str: string): string;
699
- declare function getSystemRoot(): string | null;
700
- declare function shouldUseSudoForGlobalInstall(): boolean;
701
- declare function wrapCommandWithSudo(command: string, args: string[]): {
702
- command: string;
703
- args: string[];
704
- usedSudo: boolean;
705
- };
706
- declare function commandExists$1(command: string): Promise<boolean>;
605
+ declare function chunk<T>(arr: T[], size: number): T[][];
707
606
  /**
708
- * Get possible Homebrew paths for a command on macOS
709
- * Handles both Apple Silicon (/opt/homebrew) and Intel (/usr/local) installations
710
- * Also checks npm global paths within Homebrew's node installation
711
- * and Homebrew cask installations in Caskroom
607
+ * Shuffle array randomly
712
608
  */
713
- declare function getHomebrewCommandPaths(command: string): Promise<string[]>;
609
+ declare function shuffle<T>(arr: T[]): T[];
714
610
  /**
715
- * Find the actual path of a command, checking standard PATH and Homebrew locations
716
- * Returns null if command is not found
611
+ * Get random element from array
717
612
  */
718
- declare function findCommandPath(command: string): Promise<string | null>;
613
+ declare function sample<T>(arr: T[]): T | undefined;
719
614
  /**
720
- * Find the real binary path of a command, bypassing shell functions/aliases
721
- * This is useful when a shell function wraps a command and we need the actual binary
722
- * Returns null if command is not found
615
+ * Get multiple random elements from array
723
616
  */
724
- declare function findRealCommandPath(command: string): Promise<string | null>;
617
+ declare function sampleSize<T>(arr: T[], size: number): T[];
725
618
  /**
726
- * Get recommended install methods for a code tool based on current platform
727
- * Returns methods in priority order (most recommended first)
619
+ * Partition array into two arrays based on predicate
728
620
  */
729
- type CodeType = 'claude-code' | 'codex';
730
- type InstallMethod = 'npm' | 'homebrew' | 'curl' | 'powershell' | 'cmd' | 'npm-global' | 'native';
731
- declare function getRecommendedInstallMethods(codeType: CodeType): InstallMethod[];
732
-
733
- type platform_CodeType = CodeType;
734
- type platform_InstallMethod = InstallMethod;
735
- type platform_WSLInfo = WSLInfo;
736
- declare const platform_findCommandPath: typeof findCommandPath;
737
- declare const platform_findRealCommandPath: typeof findRealCommandPath;
738
- declare const platform_getHomebrewCommandPaths: typeof getHomebrewCommandPaths;
739
- declare const platform_getMcpCommand: typeof getMcpCommand;
740
- declare const platform_getRecommendedInstallMethods: typeof getRecommendedInstallMethods;
741
- declare const platform_getSystemRoot: typeof getSystemRoot;
742
- declare const platform_getTermuxPrefix: typeof getTermuxPrefix;
743
- declare const platform_getWSLDistro: typeof getWSLDistro;
744
- declare const platform_getWSLInfo: typeof getWSLInfo;
745
- declare const platform_isTermux: typeof isTermux;
746
- declare const platform_isWSL: typeof isWSL;
747
- declare const platform_normalizeTomlPath: typeof normalizeTomlPath;
748
- declare const platform_shouldUseSudoForGlobalInstall: typeof shouldUseSudoForGlobalInstall;
749
- declare const platform_wrapCommandWithSudo: typeof wrapCommandWithSudo;
750
- declare namespace platform {
751
- export { commandExists$1 as commandExists, platform_findCommandPath as findCommandPath, platform_findRealCommandPath as findRealCommandPath, platform_getHomebrewCommandPaths as getHomebrewCommandPaths, platform_getMcpCommand as getMcpCommand, getPlatform$1 as getPlatform, platform_getRecommendedInstallMethods as getRecommendedInstallMethods, platform_getSystemRoot as getSystemRoot, platform_getTermuxPrefix as getTermuxPrefix, platform_getWSLDistro as getWSLDistro, platform_getWSLInfo as getWSLInfo, platform_isTermux as isTermux, platform_isWSL as isWSL, isWindows$1 as isWindows, platform_normalizeTomlPath as normalizeTomlPath, platform_shouldUseSudoForGlobalInstall as shouldUseSudoForGlobalInstall, platform_wrapCommandWithSudo as wrapCommandWithSudo };
752
- export type { platform_CodeType as CodeType, platform_InstallMethod as InstallMethod, platform_WSLInfo as WSLInfo };
753
- }
754
-
621
+ declare function partition<T>(arr: T[], predicate: (item: T) => boolean): [T[], T[]];
755
622
  /**
756
- * Command Execution Utilities
757
- * Provides utilities for executing shell commands
623
+ * Get intersection of arrays
758
624
  */
759
- interface CommandResult {
760
- success: boolean;
761
- stdout: string;
762
- stderr: string;
763
- exitCode: number;
764
- error?: string;
765
- }
766
- interface CommandOptions {
767
- cwd?: string;
768
- env?: Record<string, string>;
769
- timeout?: number;
770
- shell?: string | boolean;
771
- encoding?: BufferEncoding;
772
- maxBuffer?: number;
773
- }
625
+ declare function intersection<T>(...arrays: T[][]): T[];
774
626
  /**
775
- * Execute a command and return the result
627
+ * Get union of arrays
776
628
  */
777
- declare function executeCommand(command: string, args?: string[], options?: CommandOptions): Promise<CommandResult>;
629
+ declare function union<T>(...arrays: T[][]): T[];
778
630
  /**
779
- * Execute a command with streaming output
631
+ * Get difference between arrays (items in first but not in others)
780
632
  */
781
- declare function executeCommandStream(command: string, args?: string[], options?: CommandOptions & {
782
- onStdout?: (data: string) => void;
783
- onStderr?: (data: string) => void;
784
- }): Promise<CommandResult>;
633
+ declare function difference<T>(arr: T[], ...others: T[][]): T[];
785
634
  /**
786
- * Build command string from command and arguments
635
+ * Zip arrays together
787
636
  */
788
- declare function buildCommand(command: string, args: string[]): string;
637
+ declare function zip<T>(...arrays: T[][]): T[][];
789
638
  /**
790
- * Escape command argument
639
+ * Unzip array of arrays
791
640
  */
792
- declare function escapeArgument(arg: string): string;
641
+ declare function unzip<T>(arr: T[][]): T[][];
793
642
  /**
794
- * Check if a command exists in PATH
643
+ * Group consecutive elements
795
644
  */
796
- declare function commandExists(command: string): Promise<boolean>;
645
+ declare function groupConsecutive<T>(arr: T[], predicate: (a: T, b: T) => boolean): T[][];
797
646
  /**
798
- * Get command path
647
+ * Take first n elements
799
648
  */
800
- declare function getCommandPath(command: string): Promise<string | null>;
649
+ declare function take<T>(arr: T[], n: number): T[];
801
650
  /**
802
- * Parse version from command output
651
+ * Take last n elements
803
652
  */
804
- declare function parseVersion(output: string): string | null;
653
+ declare function takeLast<T>(arr: T[], n: number): T[];
805
654
  /**
806
- * Get command version
655
+ * Drop first n elements
807
656
  */
808
- declare function getCommandVersion(command: string, versionFlag?: string): Promise<string | null>;
657
+ declare function drop<T>(arr: T[], n: number): T[];
809
658
  /**
810
- * Execute multiple commands in sequence
659
+ * Drop last n elements
811
660
  */
812
- declare function executeCommandSequence(commands: Array<{
813
- command: string;
814
- args?: string[];
815
- options?: CommandOptions;
816
- }>): Promise<CommandResult[]>;
661
+ declare function dropLast<T>(arr: T[], n: number): T[];
817
662
  /**
818
- * Execute multiple commands in parallel
663
+ * Take elements while predicate is true
819
664
  */
820
- declare function executeCommandParallel(commands: Array<{
821
- command: string;
822
- args?: string[];
823
- options?: CommandOptions;
824
- }>): Promise<CommandResult[]>;
825
-
665
+ declare function takeWhile<T>(arr: T[], predicate: (item: T) => boolean): T[];
826
666
  /**
827
- * Command Utilities
828
- * Command execution and management
667
+ * Drop elements while predicate is true
829
668
  */
830
-
831
- type index$6_CommandOptions = CommandOptions;
832
- type index$6_CommandResult = CommandResult;
833
- declare const index$6_buildCommand: typeof buildCommand;
834
- declare const index$6_commandExists: typeof commandExists;
835
- declare const index$6_escapeArgument: typeof escapeArgument;
836
- declare const index$6_executeCommand: typeof executeCommand;
837
- declare const index$6_executeCommandParallel: typeof executeCommandParallel;
838
- declare const index$6_executeCommandSequence: typeof executeCommandSequence;
839
- declare const index$6_executeCommandStream: typeof executeCommandStream;
840
- declare const index$6_getCommandPath: typeof getCommandPath;
841
- declare const index$6_getCommandVersion: typeof getCommandVersion;
842
- declare const index$6_parseVersion: typeof parseVersion;
843
- declare namespace index$6 {
844
- export { index$6_buildCommand as buildCommand, index$6_commandExists as commandExists, index$6_escapeArgument as escapeArgument, index$6_executeCommand as executeCommand, index$6_executeCommandParallel as executeCommandParallel, index$6_executeCommandSequence as executeCommandSequence, index$6_executeCommandStream as executeCommandStream, index$6_getCommandPath as getCommandPath, index$6_getCommandVersion as getCommandVersion, index$6_parseVersion as parseVersion };
845
- export type { index$6_CommandOptions as CommandOptions, index$6_CommandResult as CommandResult };
846
- }
847
-
669
+ declare function dropWhile<T>(arr: T[], predicate: (item: T) => boolean): T[];
848
670
  /**
849
- * File System Utilities
850
- * Provides utilities for file system operations
671
+ * Find index of element
851
672
  */
673
+ declare function findIndex<T>(arr: T[], predicate: (item: T) => boolean): number;
852
674
  /**
853
- * Check if a file or directory exists
675
+ * Find last index of element
854
676
  */
855
- declare function exists(filePath: string): Promise<boolean>;
677
+ declare function findLastIndex<T>(arr: T[], predicate: (item: T) => boolean): number;
856
678
  /**
857
- * Check if path is a file
679
+ * Count occurrences of element
858
680
  */
859
- declare function isFile(filePath: string): Promise<boolean>;
681
+ declare function count<T>(arr: T[], item: T): number;
860
682
  /**
861
- * Check if path is a directory
683
+ * Count elements matching predicate
862
684
  */
863
- declare function isDirectory(filePath: string): Promise<boolean>;
685
+ declare function countBy<T>(arr: T[], predicate: (item: T) => boolean): number;
864
686
  /**
865
- * Create directory recursively
687
+ * Sum array of numbers
866
688
  */
867
- declare function ensureDir(dirPath: string): Promise<void>;
689
+ declare function sum(arr: number[]): number;
868
690
  /**
869
- * Read file as string
691
+ * Sum by property or function
870
692
  */
871
- declare function readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
693
+ declare function sumBy<T>(arr: T[], selector: keyof T | ((item: T) => number)): number;
872
694
  /**
873
- * Write file with content
695
+ * Get average of numbers
874
696
  */
875
- declare function writeFile(filePath: string, content: string, encoding?: BufferEncoding): Promise<void>;
697
+ declare function average(arr: number[]): number;
876
698
  /**
877
- * Append content to file
699
+ * Get minimum value
878
700
  */
879
- declare function appendFile(filePath: string, content: string, encoding?: BufferEncoding): Promise<void>;
701
+ declare function min(arr: number[]): number | undefined;
880
702
  /**
881
- * Read JSON file
703
+ * Get maximum value
882
704
  */
883
- declare function readJSON<T = any>(filePath: string): Promise<T>;
705
+ declare function max(arr: number[]): number | undefined;
884
706
  /**
885
- * Write JSON file
707
+ * Get minimum by property or function
886
708
  */
887
- declare function writeJSON(filePath: string, data: any, pretty?: boolean): Promise<void>;
709
+ declare function minBy<T>(arr: T[], selector: keyof T | ((item: T) => number)): T | undefined;
888
710
  /**
889
- * Copy file
711
+ * Get maximum by property or function
890
712
  */
891
- declare function copyFile(src: string, dest: string): Promise<void>;
713
+ declare function maxBy<T>(arr: T[], selector: keyof T | ((item: T) => number)): T | undefined;
892
714
  /**
893
- * Move/rename file
715
+ * Sort array by property or function
894
716
  */
895
- declare function moveFile(src: string, dest: string): Promise<void>;
717
+ declare function sortBy<T>(arr: T[], selector: keyof T | ((item: T) => any), order?: 'asc' | 'desc'): T[];
896
718
  /**
897
- * Delete file
719
+ * Check if array is empty
898
720
  */
899
- declare function deleteFile(filePath: string): Promise<void>;
721
+ declare function isEmpty$1<T>(arr: T[]): boolean;
900
722
  /**
901
- * Delete directory recursively
723
+ * Compact array (remove falsy values)
902
724
  */
903
- declare function deleteDir(dirPath: string): Promise<void>;
725
+ declare function compact$1<T>(arr: T[]): NonNullable<T>[];
904
726
  /**
905
- * List files in directory
727
+ * Range of numbers
906
728
  */
907
- declare function listFiles(dirPath: string, recursive?: boolean): Promise<string[]>;
729
+ declare function range(start: number, end?: number, step?: number): number[];
908
730
  /**
909
- * List directories in directory
731
+ * Rotate array by n positions
910
732
  */
911
- declare function listDirs(dirPath: string): Promise<string[]>;
733
+ declare function rotate<T>(arr: T[], n: number): T[];
912
734
  /**
913
- * Get file size in bytes
735
+ * Check if arrays are equal
914
736
  */
915
- declare function getFileSize(filePath: string): Promise<number>;
737
+ declare function isEqual$1<T>(arr1: T[], arr2: T[]): boolean;
738
+
916
739
  /**
917
- * Get file modification time
740
+ * Array Utilities
741
+ * Array manipulation and transformation
918
742
  */
919
- declare function getModifiedTime(filePath: string): Promise<Date>;
743
+
744
+ declare const index$6_average: typeof average;
745
+ declare const index$6_chunk: typeof chunk;
746
+ declare const index$6_count: typeof count;
747
+ declare const index$6_countBy: typeof countBy;
748
+ declare const index$6_difference: typeof difference;
749
+ declare const index$6_drop: typeof drop;
750
+ declare const index$6_dropLast: typeof dropLast;
751
+ declare const index$6_dropWhile: typeof dropWhile;
752
+ declare const index$6_findIndex: typeof findIndex;
753
+ declare const index$6_findLastIndex: typeof findLastIndex;
754
+ declare const index$6_groupConsecutive: typeof groupConsecutive;
755
+ declare const index$6_intersection: typeof intersection;
756
+ declare const index$6_max: typeof max;
757
+ declare const index$6_maxBy: typeof maxBy;
758
+ declare const index$6_min: typeof min;
759
+ declare const index$6_minBy: typeof minBy;
760
+ declare const index$6_partition: typeof partition;
761
+ declare const index$6_range: typeof range;
762
+ declare const index$6_rotate: typeof rotate;
763
+ declare const index$6_sample: typeof sample;
764
+ declare const index$6_sampleSize: typeof sampleSize;
765
+ declare const index$6_shuffle: typeof shuffle;
766
+ declare const index$6_sortBy: typeof sortBy;
767
+ declare const index$6_sum: typeof sum;
768
+ declare const index$6_sumBy: typeof sumBy;
769
+ declare const index$6_take: typeof take;
770
+ declare const index$6_takeLast: typeof takeLast;
771
+ declare const index$6_takeWhile: typeof takeWhile;
772
+ declare const index$6_union: typeof union;
773
+ declare const index$6_unique: typeof unique;
774
+ declare const index$6_uniqueBy: typeof uniqueBy;
775
+ declare const index$6_unzip: typeof unzip;
776
+ declare const index$6_zip: typeof zip;
777
+ declare namespace index$6 {
778
+ export {
779
+ index$6_average as average,
780
+ index$6_chunk as chunk,
781
+ compact$1 as compact,
782
+ index$6_count as count,
783
+ index$6_countBy as countBy,
784
+ index$6_difference as difference,
785
+ index$6_drop as drop,
786
+ index$6_dropLast as dropLast,
787
+ index$6_dropWhile as dropWhile,
788
+ index$6_findIndex as findIndex,
789
+ index$6_findLastIndex as findLastIndex,
790
+ flatten$1 as flatten,
791
+ index$6_groupConsecutive as groupConsecutive,
792
+ index$6_intersection as intersection,
793
+ isEmpty$1 as isEmpty,
794
+ isEqual$1 as isEqual,
795
+ index$6_max as max,
796
+ index$6_maxBy as maxBy,
797
+ index$6_min as min,
798
+ index$6_minBy as minBy,
799
+ index$6_partition as partition,
800
+ index$6_range as range,
801
+ index$6_rotate as rotate,
802
+ index$6_sample as sample,
803
+ index$6_sampleSize as sampleSize,
804
+ index$6_shuffle as shuffle,
805
+ index$6_sortBy as sortBy,
806
+ index$6_sum as sum,
807
+ index$6_sumBy as sumBy,
808
+ index$6_take as take,
809
+ index$6_takeLast as takeLast,
810
+ index$6_takeWhile as takeWhile,
811
+ index$6_union as union,
812
+ index$6_unique as unique,
813
+ index$6_uniqueBy as uniqueBy,
814
+ index$6_unzip as unzip,
815
+ index$6_zip as zip,
816
+ };
817
+ }
818
+
920
819
  /**
921
- * Get file creation time
820
+ * Async Utilities
821
+ * Asynchronous operation helpers
922
822
  */
923
- declare function getCreatedTime(filePath: string): Promise<Date>;
924
823
  /**
925
- * Check if file is readable
824
+ * Sleep for specified milliseconds
926
825
  */
927
- declare function isReadable(filePath: string): Promise<boolean>;
826
+ declare function sleep(ms: number): Promise<void>;
928
827
  /**
929
- * Check if file is writable
828
+ * Retry async function with exponential backoff
930
829
  */
931
- declare function isWritable(filePath: string): Promise<boolean>;
830
+ declare function retry<T>(fn: () => Promise<T>, options?: {
831
+ maxAttempts?: number;
832
+ delay?: number;
833
+ backoff?: number;
834
+ onRetry?: (error: Error, attempt: number) => void;
835
+ }): Promise<T>;
932
836
  /**
933
- * Check if file is executable
837
+ * Timeout a promise
934
838
  */
935
- declare function isExecutable(filePath: string): Promise<boolean>;
839
+ declare function timeout<T>(promise: Promise<T>, ms: number, errorMessage?: string): Promise<T>;
936
840
  /**
937
- * Find files matching pattern
841
+ * Debounce async function
938
842
  */
939
- declare function findFiles(dirPath: string, pattern: RegExp | string, recursive?: boolean): Promise<string[]>;
843
+ declare function debounce<T extends (...args: any[]) => Promise<any>>(fn: T, delay: number): (...args: Parameters<T>) => Promise<ReturnType<T>>;
940
844
  /**
941
- * Get directory size (total size of all files)
845
+ * Throttle async function
942
846
  */
943
- declare function getDirSize(dirPath: string): Promise<number>;
847
+ declare function throttle<T extends (...args: any[]) => Promise<any>>(fn: T, delay: number): (...args: Parameters<T>) => Promise<ReturnType<T>>;
944
848
  /**
945
- * Copy directory recursively
849
+ * Execute promises in parallel with concurrency limit
946
850
  */
947
- declare function copyDir(src: string, dest: string): Promise<void>;
851
+ declare function parallelLimit<T>(tasks: (() => Promise<T>)[], limit: number): Promise<T[]>;
948
852
  /**
949
- * Empty directory (delete all contents but keep directory)
853
+ * Execute promises in sequence
950
854
  */
951
- declare function emptyDir(dirPath: string): Promise<void>;
952
-
855
+ declare function sequence<T>(tasks: (() => Promise<T>)[]): Promise<T[]>;
953
856
  /**
954
- * File System Utilities
955
- * File and directory operations
857
+ * Execute promises with all settled (no rejection)
956
858
  */
957
-
958
- declare const index$5_appendFile: typeof appendFile;
959
- declare const index$5_copyDir: typeof copyDir;
960
- declare const index$5_copyFile: typeof copyFile;
961
- declare const index$5_deleteDir: typeof deleteDir;
962
- declare const index$5_deleteFile: typeof deleteFile;
963
- declare const index$5_emptyDir: typeof emptyDir;
964
- declare const index$5_ensureDir: typeof ensureDir;
965
- declare const index$5_exists: typeof exists;
966
- declare const index$5_findFiles: typeof findFiles;
967
- declare const index$5_getCreatedTime: typeof getCreatedTime;
968
- declare const index$5_getDirSize: typeof getDirSize;
969
- declare const index$5_getFileSize: typeof getFileSize;
970
- declare const index$5_getModifiedTime: typeof getModifiedTime;
971
- declare const index$5_isDirectory: typeof isDirectory;
972
- declare const index$5_isExecutable: typeof isExecutable;
973
- declare const index$5_isFile: typeof isFile;
974
- declare const index$5_isReadable: typeof isReadable;
975
- declare const index$5_isWritable: typeof isWritable;
976
- declare const index$5_listDirs: typeof listDirs;
977
- declare const index$5_listFiles: typeof listFiles;
978
- declare const index$5_moveFile: typeof moveFile;
979
- declare const index$5_readFile: typeof readFile;
980
- declare const index$5_readJSON: typeof readJSON;
981
- declare const index$5_writeFile: typeof writeFile;
982
- declare const index$5_writeJSON: typeof writeJSON;
983
- declare namespace index$5 {
984
- export {
985
- index$5_appendFile as appendFile,
986
- index$5_copyDir as copyDir,
987
- index$5_copyFile as copyFile,
988
- index$5_deleteDir as deleteDir,
989
- index$5_deleteFile as deleteFile,
990
- index$5_emptyDir as emptyDir,
991
- index$5_ensureDir as ensureDir,
992
- index$5_exists as exists,
993
- index$5_findFiles as findFiles,
994
- index$5_getCreatedTime as getCreatedTime,
995
- index$5_getDirSize as getDirSize,
996
- index$5_getFileSize as getFileSize,
997
- index$5_getModifiedTime as getModifiedTime,
998
- index$5_isDirectory as isDirectory,
999
- index$5_isExecutable as isExecutable,
1000
- index$5_isFile as isFile,
1001
- index$5_isReadable as isReadable,
1002
- index$5_isWritable as isWritable,
1003
- index$5_listDirs as listDirs,
1004
- index$5_listFiles as listFiles,
1005
- index$5_moveFile as moveFile,
1006
- index$5_readFile as readFile,
1007
- index$5_readJSON as readJSON,
1008
- index$5_writeFile as writeFile,
1009
- index$5_writeJSON as writeJSON,
1010
- };
1011
- }
1012
-
859
+ declare function allSettled<T>(promises: Promise<T>[]): Promise<Array<{
860
+ status: 'fulfilled';
861
+ value: T;
862
+ } | {
863
+ status: 'rejected';
864
+ reason: any;
865
+ }>>;
1013
866
  /**
1014
- * Unified Input Validation Library
1015
- * Provides reusable validation functions for common input types
867
+ * Race promises with timeout
1016
868
  */
869
+ declare function raceWithTimeout<T>(promises: Promise<T>[], ms: number): Promise<T>;
1017
870
  /**
1018
- * Validation result interface
871
+ * Memoize async function
1019
872
  */
1020
- interface ValidationResult$1 {
1021
- valid: boolean;
1022
- error?: string;
873
+ declare function memoize<T extends (...args: any[]) => Promise<any>>(fn: T, options?: {
874
+ keyGenerator?: (...args: Parameters<T>) => string;
875
+ ttl?: number;
876
+ }): T;
877
+ /**
878
+ * Create a deferred promise
879
+ */
880
+ interface Deferred<T> {
881
+ promise: Promise<T>;
882
+ resolve: (value: T) => void;
883
+ reject: (reason?: any) => void;
1023
884
  }
885
+ declare function defer<T>(): Deferred<T>;
1024
886
  /**
1025
- * Validate array access safety
887
+ * Wait for condition to be true
1026
888
  */
1027
- declare function validateArrayAccess<T>(array: T[] | null | undefined, index: number): ValidationResult$1;
889
+ declare function waitFor(condition: () => boolean | Promise<boolean>, options?: {
890
+ timeout?: number;
891
+ interval?: number;
892
+ timeoutMessage?: string;
893
+ }): Promise<void>;
1028
894
  /**
1029
- * Safely access array element
895
+ * Execute function with mutex lock
1030
896
  */
1031
- declare function safeArrayAccess<T>(array: T[] | null | undefined, index: number, defaultValue?: T): T | undefined;
897
+ declare class Mutex {
898
+ private locked;
899
+ private queue;
900
+ acquire(): Promise<void>;
901
+ release(): void;
902
+ runExclusive<T>(fn: () => Promise<T>): Promise<T>;
903
+ }
1032
904
  /**
1033
- * Validate object key access
905
+ * Create a semaphore for limiting concurrent operations
1034
906
  */
1035
- declare function validateObjectKeyAccess<T extends Record<string, unknown>>(obj: T | null | undefined, key: string): ValidationResult$1;
907
+ declare class Semaphore {
908
+ private permits;
909
+ private queue;
910
+ constructor(permits: number);
911
+ acquire(): Promise<void>;
912
+ release(): void;
913
+ runExclusive<T>(fn: () => Promise<T>): Promise<T>;
914
+ }
1036
915
  /**
1037
- * Safely access object property
916
+ * Batch async operations
1038
917
  */
1039
- declare function safeObjectAccess<T extends Record<string, unknown>, K extends keyof T>(obj: T | null | undefined, key: K, defaultValue?: T[K]): T[K] | undefined;
918
+ declare function batch<T, R>(items: T[], batchSize: number, processor: (batch: T[]) => Promise<R[]>): Promise<R[]>;
1040
919
  /**
1041
- * Validate environment variable name
920
+ * Poll for result
1042
921
  */
1043
- declare function isValidEnvVarName(name: string): ValidationResult$1;
922
+ declare function poll<T>(fn: () => Promise<T>, options?: {
923
+ interval?: number;
924
+ timeout?: number;
925
+ validate?: (result: T) => boolean;
926
+ }): Promise<T>;
927
+
1044
928
  /**
1045
- * Sanitize environment variable value
929
+ * Async Utilities
930
+ * Asynchronous operation helpers
1046
931
  */
1047
- declare function sanitizeEnvValue(value: string): string;
932
+
933
+ type index$5_Deferred<T> = Deferred<T>;
934
+ type index$5_Mutex = Mutex;
935
+ declare const index$5_Mutex: typeof Mutex;
936
+ type index$5_Semaphore = Semaphore;
937
+ declare const index$5_Semaphore: typeof Semaphore;
938
+ declare const index$5_allSettled: typeof allSettled;
939
+ declare const index$5_batch: typeof batch;
940
+ declare const index$5_debounce: typeof debounce;
941
+ declare const index$5_defer: typeof defer;
942
+ declare const index$5_memoize: typeof memoize;
943
+ declare const index$5_parallelLimit: typeof parallelLimit;
944
+ declare const index$5_poll: typeof poll;
945
+ declare const index$5_raceWithTimeout: typeof raceWithTimeout;
946
+ declare const index$5_retry: typeof retry;
947
+ declare const index$5_sequence: typeof sequence;
948
+ declare const index$5_sleep: typeof sleep;
949
+ declare const index$5_throttle: typeof throttle;
950
+ declare const index$5_timeout: typeof timeout;
951
+ declare const index$5_waitFor: typeof waitFor;
952
+ declare namespace index$5 {
953
+ export { index$5_Mutex as Mutex, index$5_Semaphore as Semaphore, index$5_allSettled as allSettled, index$5_batch as batch, index$5_debounce as debounce, index$5_defer as defer, index$5_memoize as memoize, index$5_parallelLimit as parallelLimit, index$5_poll as poll, index$5_raceWithTimeout as raceWithTimeout, index$5_retry as retry, index$5_sequence as sequence, index$5_sleep as sleep, index$5_throttle as throttle, index$5_timeout as timeout, index$5_waitFor as waitFor };
954
+ export type { index$5_Deferred as Deferred };
955
+ }
956
+
1048
957
  /**
1049
- * Validate URL format
958
+ * Command Execution Utilities
959
+ * Provides utilities for executing shell commands
1050
960
  */
1051
- declare function isValidUrl(url: string): ValidationResult$1;
961
+ interface CommandResult {
962
+ success: boolean;
963
+ stdout: string;
964
+ stderr: string;
965
+ exitCode: number;
966
+ error?: string;
967
+ }
968
+ interface CommandOptions {
969
+ cwd?: string;
970
+ env?: Record<string, string>;
971
+ timeout?: number;
972
+ shell?: string | boolean;
973
+ encoding?: BufferEncoding;
974
+ maxBuffer?: number;
975
+ }
1052
976
  /**
1053
- * Validate file path safety (no directory traversal)
977
+ * Execute a command and return the result
1054
978
  */
1055
- declare function isValidFilePath(path: string): ValidationResult$1;
979
+ declare function executeCommand(command: string, args?: string[], options?: CommandOptions): Promise<CommandResult>;
1056
980
  /**
1057
- * Validate path entry (filename or directory name)
981
+ * Execute a command with streaming output
1058
982
  */
1059
- declare function isValidPathEntry(entry: string): ValidationResult$1;
983
+ declare function executeCommandStream(command: string, args?: string[], options?: CommandOptions & {
984
+ onStdout?: (data: string) => void;
985
+ onStderr?: (data: string) => void;
986
+ }): Promise<CommandResult>;
1060
987
  /**
1061
- * Validate user input string
988
+ * Build command string from command and arguments
1062
989
  */
1063
- declare function validateUserInput(input: string, options?: {
1064
- minLength?: number;
1065
- maxLength?: number;
1066
- pattern?: RegExp;
1067
- allowedChars?: string;
1068
- }): ValidationResult$1;
990
+ declare function buildCommand(command: string, args: string[]): string;
1069
991
  /**
1070
- * Sanitize user input
992
+ * Escape command argument
1071
993
  */
1072
- declare function sanitizeUserInput(input: string, maxLength?: number): string;
994
+ declare function escapeArgument(arg: string): string;
1073
995
  /**
1074
- * Validate API key format
996
+ * Check if a command exists in PATH
1075
997
  */
1076
- declare function isValidApiKey(apiKey: string): ValidationResult$1;
998
+ declare function commandExists$1(command: string): Promise<boolean>;
1077
999
  /**
1078
- * Format API key for display (mask sensitive parts)
1000
+ * Get command path
1079
1001
  */
1080
- declare function formatApiKeyDisplay(apiKey: string | null | undefined): string;
1002
+ declare function getCommandPath(command: string): Promise<string | null>;
1081
1003
  /**
1082
- * Validate configuration object structure
1004
+ * Parse version from command output
1083
1005
  */
1084
- declare function validateConfigStructure(config: unknown, schema: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>): ValidationResult$1;
1006
+ declare function parseVersion(output: string): string | null;
1085
1007
  /**
1086
- * Validate array of items
1008
+ * Get command version
1087
1009
  */
1088
- declare function validateArray(array: unknown, validator: (item: unknown) => ValidationResult$1): ValidationResult$1;
1010
+ declare function getCommandVersion(command: string, versionFlag?: string): Promise<string | null>;
1089
1011
  /**
1090
- * Validate enum value
1012
+ * Execute multiple commands in sequence
1091
1013
  */
1092
- declare function isValidEnumValue<T extends string | number>(value: unknown, allowedValues: T[]): ValidationResult$1;
1014
+ declare function executeCommandSequence(commands: Array<{
1015
+ command: string;
1016
+ args?: string[];
1017
+ options?: CommandOptions;
1018
+ }>): Promise<CommandResult[]>;
1093
1019
  /**
1094
- * Validate port number
1020
+ * Execute multiple commands in parallel
1095
1021
  */
1096
- declare function isValidPort(port: unknown): ValidationResult$1;
1022
+ declare function executeCommandParallel(commands: Array<{
1023
+ command: string;
1024
+ args?: string[];
1025
+ options?: CommandOptions;
1026
+ }>): Promise<CommandResult[]>;
1027
+
1097
1028
  /**
1098
- * Validate hostname
1029
+ * Command Utilities
1030
+ * Command execution and management
1099
1031
  */
1100
- declare function isValidHostname(hostname: string): ValidationResult$1;
1101
1032
 
1102
- declare const validation_formatApiKeyDisplay: typeof formatApiKeyDisplay;
1103
- declare const validation_isValidApiKey: typeof isValidApiKey;
1104
- declare const validation_isValidEnumValue: typeof isValidEnumValue;
1105
- declare const validation_isValidEnvVarName: typeof isValidEnvVarName;
1106
- declare const validation_isValidFilePath: typeof isValidFilePath;
1107
- declare const validation_isValidHostname: typeof isValidHostname;
1108
- declare const validation_isValidPathEntry: typeof isValidPathEntry;
1109
- declare const validation_isValidPort: typeof isValidPort;
1110
- declare const validation_isValidUrl: typeof isValidUrl;
1111
- declare const validation_safeArrayAccess: typeof safeArrayAccess;
1112
- declare const validation_safeObjectAccess: typeof safeObjectAccess;
1113
- declare const validation_sanitizeEnvValue: typeof sanitizeEnvValue;
1114
- declare const validation_sanitizeUserInput: typeof sanitizeUserInput;
1115
- declare const validation_validateArray: typeof validateArray;
1116
- declare const validation_validateArrayAccess: typeof validateArrayAccess;
1117
- declare const validation_validateConfigStructure: typeof validateConfigStructure;
1118
- declare const validation_validateObjectKeyAccess: typeof validateObjectKeyAccess;
1119
- declare const validation_validateUserInput: typeof validateUserInput;
1120
- declare namespace validation {
1121
- export { validation_formatApiKeyDisplay as formatApiKeyDisplay, validation_isValidApiKey as isValidApiKey, validation_isValidEnumValue as isValidEnumValue, validation_isValidEnvVarName as isValidEnvVarName, validation_isValidFilePath as isValidFilePath, validation_isValidHostname as isValidHostname, validation_isValidPathEntry as isValidPathEntry, validation_isValidPort as isValidPort, validation_isValidUrl as isValidUrl, validation_safeArrayAccess as safeArrayAccess, validation_safeObjectAccess as safeObjectAccess, validation_sanitizeEnvValue as sanitizeEnvValue, validation_sanitizeUserInput as sanitizeUserInput, validation_validateArray as validateArray, validation_validateArrayAccess as validateArrayAccess, validation_validateConfigStructure as validateConfigStructure, validation_validateObjectKeyAccess as validateObjectKeyAccess, validation_validateUserInput as validateUserInput };
1122
- export type { ValidationResult$1 as ValidationResult };
1033
+ type index$4_CommandOptions = CommandOptions;
1034
+ type index$4_CommandResult = CommandResult;
1035
+ declare const index$4_buildCommand: typeof buildCommand;
1036
+ declare const index$4_escapeArgument: typeof escapeArgument;
1037
+ declare const index$4_executeCommand: typeof executeCommand;
1038
+ declare const index$4_executeCommandParallel: typeof executeCommandParallel;
1039
+ declare const index$4_executeCommandSequence: typeof executeCommandSequence;
1040
+ declare const index$4_executeCommandStream: typeof executeCommandStream;
1041
+ declare const index$4_getCommandPath: typeof getCommandPath;
1042
+ declare const index$4_getCommandVersion: typeof getCommandVersion;
1043
+ declare const index$4_parseVersion: typeof parseVersion;
1044
+ declare namespace index$4 {
1045
+ export { index$4_buildCommand as buildCommand, commandExists$1 as commandExists, index$4_escapeArgument as escapeArgument, index$4_executeCommand as executeCommand, index$4_executeCommandParallel as executeCommandParallel, index$4_executeCommandSequence as executeCommandSequence, index$4_executeCommandStream as executeCommandStream, index$4_getCommandPath as getCommandPath, index$4_getCommandVersion as getCommandVersion, index$4_parseVersion as parseVersion };
1046
+ export type { index$4_CommandOptions as CommandOptions, index$4_CommandResult as CommandResult };
1123
1047
  }
1124
1048
 
1049
+ declare const AI_OUTPUT_LANGUAGES: {
1050
+ readonly 'zh-CN': {
1051
+ readonly directive: "Always respond in Chinese-simplified";
1052
+ };
1053
+ readonly en: {
1054
+ readonly directive: "Always respond in English";
1055
+ };
1056
+ readonly custom: {
1057
+ readonly directive: "";
1058
+ };
1059
+ };
1060
+ type AiOutputLanguage = keyof typeof AI_OUTPUT_LANGUAGES;
1061
+
1125
1062
  /**
1126
- * String Utilities
1127
- * String manipulation and formatting functions
1128
- */
1129
- /**
1130
- * Capitalize first letter of string
1131
- */
1132
- declare function capitalize(str: string): string;
1133
- /**
1134
- * Convert string to camelCase
1135
- */
1136
- declare function camelCase(str: string): string;
1137
- /**
1138
- * Convert string to PascalCase
1063
+ * API configuration for Claude Code
1139
1064
  */
1140
- declare function pascalCase(str: string): string;
1065
+ interface ApiConfig {
1066
+ url: string;
1067
+ key: string;
1068
+ authType?: 'auth_token' | 'api_key';
1069
+ }
1070
+
1071
+ declare function ensureClaudeDir(): void;
1072
+ declare function backupExistingConfig(): string | null;
1073
+ declare function copyConfigFiles(onlyMd?: boolean): void;
1074
+ declare function configureApi(apiConfig: ApiConfig | null): ApiConfig | null;
1075
+ declare function mergeConfigs(sourceFile: string, targetFile: string): void;
1141
1076
  /**
1142
- * Convert string to snake_case
1077
+ * Update custom model configuration using environment variables
1078
+ * @param primaryModel - Primary model name for general tasks
1079
+ * @param haikuModel - Default Haiku model (optional)
1080
+ * @param sonnetModel - Default Sonnet model (optional)
1081
+ * @param opusModel - Default Opus model (optional)
1143
1082
  */
1144
- declare function snakeCase(str: string): string;
1083
+ declare function updateCustomModel(primaryModel?: string, haikuModel?: string, sonnetModel?: string, opusModel?: string): void;
1145
1084
  /**
1146
- * Convert string to kebab-case
1085
+ * Update the default model configuration in settings.json
1086
+ * @param model - The model type to set: opus, sonnet, sonnet[1m], default, or custom
1087
+ * Note: 'custom' model type is handled differently - it should use environment variables instead
1147
1088
  */
1148
- declare function kebabCase(str: string): string;
1089
+ declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom'): void;
1149
1090
  /**
1150
- * Convert string to CONSTANT_CASE
1091
+ * Merge settings.json intelligently
1092
+ * Preserves user's environment variables and custom configurations
1151
1093
  */
1152
- declare function constantCase(str: string): string;
1094
+ declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
1153
1095
  /**
1154
- * Truncate string to specified length
1096
+ * Get existing model configuration from settings.json
1155
1097
  */
1156
- declare function truncate(str: string, length: number, suffix?: string): string;
1098
+ declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom' | null;
1157
1099
  /**
1158
- * Pad string to specified length
1100
+ * Get existing API configuration from settings.json
1159
1101
  */
1160
- declare function pad(str: string, length: number, char?: string, direction?: 'left' | 'right' | 'both'): string;
1102
+ declare function getExistingApiConfig(): ApiConfig | null;
1103
+ declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
1161
1104
  /**
1162
- * Remove whitespace from both ends
1105
+ * Switch to official login mode - remove all third-party API configurations
1106
+ * Removes: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY from settings.json
1107
+ * Removes: primaryApiKey from ~/.claude/config.json
1163
1108
  */
1164
- declare function trim(str: string): string;
1109
+ declare function switchToOfficialLogin(): boolean;
1165
1110
  /**
1166
- * Remove whitespace from start
1111
+ * Prompt user for API configuration action when existing config is found
1112
+ * Returns the user's choice for how to handle existing configuration
1167
1113
  */
1168
- declare function trimStart(str: string): string;
1114
+ declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
1115
+
1116
+ type config_ApiConfig = ApiConfig;
1117
+ declare const config_applyAiLanguageDirective: typeof applyAiLanguageDirective;
1118
+ declare const config_backupExistingConfig: typeof backupExistingConfig;
1119
+ declare const config_configureApi: typeof configureApi;
1120
+ declare const config_copyConfigFiles: typeof copyConfigFiles;
1121
+ declare const config_ensureClaudeDir: typeof ensureClaudeDir;
1122
+ declare const config_getExistingApiConfig: typeof getExistingApiConfig;
1123
+ declare const config_getExistingModelConfig: typeof getExistingModelConfig;
1124
+ declare const config_mergeConfigs: typeof mergeConfigs;
1125
+ declare const config_mergeSettingsFile: typeof mergeSettingsFile;
1126
+ declare const config_promptApiConfigurationAction: typeof promptApiConfigurationAction;
1127
+ declare const config_switchToOfficialLogin: typeof switchToOfficialLogin;
1128
+ declare const config_updateCustomModel: typeof updateCustomModel;
1129
+ declare const config_updateDefaultModel: typeof updateDefaultModel;
1130
+ declare namespace config {
1131
+ export { config_applyAiLanguageDirective as applyAiLanguageDirective, config_backupExistingConfig as backupExistingConfig, config_configureApi as configureApi, config_copyConfigFiles as copyConfigFiles, config_ensureClaudeDir as ensureClaudeDir, config_getExistingApiConfig as getExistingApiConfig, config_getExistingModelConfig as getExistingModelConfig, config_mergeConfigs as mergeConfigs, config_mergeSettingsFile as mergeSettingsFile, config_promptApiConfigurationAction as promptApiConfigurationAction, config_switchToOfficialLogin as switchToOfficialLogin, config_updateCustomModel as updateCustomModel, config_updateDefaultModel as updateDefaultModel };
1132
+ export type { config_ApiConfig as ApiConfig };
1133
+ }
1134
+
1169
1135
  /**
1170
- * Remove whitespace from end
1136
+ * Configuration Manager
1137
+ * Provides utilities for loading, saving, and managing configuration files
1171
1138
  */
1172
- declare function trimEnd(str: string): string;
1139
+ interface ConfigOptions {
1140
+ configDir?: string;
1141
+ fileName?: string;
1142
+ createIfMissing?: boolean;
1143
+ validate?: (config: any) => boolean;
1144
+ }
1173
1145
  /**
1174
- * Split string by delimiter
1146
+ * Configuration Manager class
1147
+ * Handles configuration file operations with validation and error handling
1175
1148
  */
1176
- declare function split(str: string, delimiter: string | RegExp): string[];
1149
+ declare class ConfigManager<T = any> {
1150
+ private readonly namespace;
1151
+ private configPath;
1152
+ private options;
1153
+ private cache?;
1154
+ constructor(namespace: string, options?: ConfigOptions);
1155
+ /**
1156
+ * Get the default configuration directory
1157
+ */
1158
+ private getDefaultConfigDir;
1159
+ /**
1160
+ * Load configuration from file
1161
+ */
1162
+ load(): Promise<T | null>;
1163
+ /**
1164
+ * Save configuration to file
1165
+ */
1166
+ save(config: T): Promise<void>;
1167
+ /**
1168
+ * Update configuration (merge with existing)
1169
+ */
1170
+ update(updates: Partial<T>): Promise<T>;
1171
+ /**
1172
+ * Delete configuration file
1173
+ */
1174
+ delete(): Promise<void>;
1175
+ /**
1176
+ * Check if configuration file exists
1177
+ */
1178
+ exists(): Promise<boolean>;
1179
+ /**
1180
+ * Get configuration path
1181
+ */
1182
+ getPath(): string;
1183
+ /**
1184
+ * Get cached configuration (without file I/O)
1185
+ */
1186
+ getCached(): T | undefined;
1187
+ /**
1188
+ * Clear cache
1189
+ */
1190
+ clearCache(): void;
1191
+ }
1177
1192
  /**
1178
- * Join array of strings
1193
+ * Create a configuration manager instance
1179
1194
  */
1180
- declare function join(arr: string[], separator?: string): string;
1195
+ declare function createConfigManager<T = any>(namespace: string, options?: ConfigOptions): ConfigManager<T>;
1196
+
1181
1197
  /**
1182
- * Replace all occurrences of search with replacement
1198
+ * Configuration Validator
1199
+ * Provides utilities for validating configuration objects
1183
1200
  */
1184
- declare function replaceAll(str: string, search: string | RegExp, replacement: string): string;
1201
+ interface ValidationRule<T = any> {
1202
+ field: keyof T;
1203
+ required?: boolean;
1204
+ type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
1205
+ validator?: (value: any) => boolean;
1206
+ message?: string;
1207
+ }
1208
+ interface ValidationError$1 {
1209
+ field: string;
1210
+ message: string;
1211
+ }
1212
+ interface ValidationResult$1 {
1213
+ valid: boolean;
1214
+ errors: ValidationError$1[];
1215
+ }
1185
1216
  /**
1186
- * Check if string starts with prefix
1217
+ * Configuration Validator class
1187
1218
  */
1188
- declare function startsWith(str: string, prefix: string): boolean;
1219
+ declare class ConfigValidator<T = any> {
1220
+ private rules;
1221
+ constructor(rules: ValidationRule<T>[]);
1222
+ /**
1223
+ * Validate a configuration object
1224
+ */
1225
+ validate(config: Partial<T>): ValidationResult$1;
1226
+ /**
1227
+ * Validate and throw on error
1228
+ */
1229
+ validateOrThrow(config: Partial<T>): void;
1230
+ }
1189
1231
  /**
1190
- * Check if string ends with suffix
1232
+ * Create a configuration validator
1191
1233
  */
1192
- declare function endsWith(str: string, suffix: string): boolean;
1234
+ declare function createValidator<T = any>(rules: ValidationRule<T>[]): ConfigValidator<T>;
1193
1235
  /**
1194
- * Check if string contains substring
1236
+ * Common validation functions
1195
1237
  */
1196
- declare function contains(str: string, substring: string): boolean;
1238
+ declare const validators: {
1239
+ /**
1240
+ * Validate string is not empty
1241
+ */
1242
+ notEmpty: (value: string) => boolean;
1243
+ /**
1244
+ * Validate string matches pattern
1245
+ */
1246
+ pattern: (regex: RegExp) => (value: string) => boolean;
1247
+ /**
1248
+ * Validate number is in range
1249
+ */
1250
+ range: (min: number, max: number) => (value: number) => boolean;
1251
+ /**
1252
+ * Validate string length
1253
+ */
1254
+ length: (min: number, max?: number) => (value: string) => boolean;
1255
+ /**
1256
+ * Validate value is one of allowed values
1257
+ */
1258
+ oneOf: <T>(allowed: T[]) => (value: T) => boolean;
1259
+ /**
1260
+ * Validate email format
1261
+ */
1262
+ email: (value: string) => boolean;
1263
+ /**
1264
+ * Validate URL format
1265
+ */
1266
+ url: (value: string) => boolean;
1267
+ /**
1268
+ * Validate object has required keys
1269
+ */
1270
+ hasKeys: (keys: string[]) => (value: any) => boolean;
1271
+ /**
1272
+ * Validate array is not empty
1273
+ */
1274
+ notEmptyArray: (value: any[]) => boolean;
1275
+ };
1276
+
1197
1277
  /**
1198
- * Count occurrences of substring
1278
+ * Error Utilities
1279
+ * Error handling and custom error classes
1199
1280
  */
1200
- declare function countOccurrences(str: string, substring: string): number;
1201
1281
  /**
1202
- * Reverse string
1282
+ * Base custom error class
1203
1283
  */
1204
- declare function reverse(str: string): string;
1284
+ declare class BaseError extends Error {
1285
+ readonly code?: string | undefined;
1286
+ readonly statusCode?: number | undefined;
1287
+ readonly details?: any | undefined;
1288
+ constructor(message: string, code?: string | undefined, statusCode?: number | undefined, details?: any | undefined);
1289
+ toJSON(): {
1290
+ name: string;
1291
+ message: string;
1292
+ code: string | undefined;
1293
+ statusCode: number | undefined;
1294
+ details: any;
1295
+ stack: string | undefined;
1296
+ };
1297
+ }
1205
1298
  /**
1206
- * Remove all whitespace
1299
+ * Validation error
1207
1300
  */
1208
- declare function removeWhitespace(str: string): string;
1301
+ declare class ValidationError extends BaseError {
1302
+ constructor(message: string, details?: any);
1303
+ }
1209
1304
  /**
1210
- * Normalize whitespace (replace multiple spaces with single space)
1305
+ * Not found error
1211
1306
  */
1212
- declare function normalizeWhitespace(str: string): string;
1307
+ declare class NotFoundError extends BaseError {
1308
+ constructor(message: string, details?: any);
1309
+ }
1213
1310
  /**
1214
- * Extract words from string
1311
+ * Unauthorized error
1215
1312
  */
1216
- declare function words(str: string): string[];
1313
+ declare class UnauthorizedError extends BaseError {
1314
+ constructor(message: string, details?: any);
1315
+ }
1217
1316
  /**
1218
- * Count words in string
1317
+ * Forbidden error
1219
1318
  */
1220
- declare function wordCount(str: string): number;
1319
+ declare class ForbiddenError extends BaseError {
1320
+ constructor(message: string, details?: any);
1321
+ }
1221
1322
  /**
1222
- * Convert string to title case
1323
+ * Conflict error
1223
1324
  */
1224
- declare function titleCase(str: string): string;
1325
+ declare class ConflictError extends BaseError {
1326
+ constructor(message: string, details?: any);
1327
+ }
1225
1328
  /**
1226
- * Convert string to sentence case
1329
+ * Timeout error
1227
1330
  */
1228
- declare function sentenceCase(str: string): string;
1331
+ declare class TimeoutError extends BaseError {
1332
+ constructor(message: string, details?: any);
1333
+ }
1229
1334
  /**
1230
- * Escape HTML special characters
1335
+ * Internal error
1231
1336
  */
1232
- declare function escapeHTML(str: string): string;
1337
+ declare class InternalError extends BaseError {
1338
+ constructor(message: string, details?: any);
1339
+ }
1233
1340
  /**
1234
- * Unescape HTML special characters
1341
+ * Configuration error
1235
1342
  */
1236
- declare function unescapeHTML(str: string): string;
1343
+ declare class ConfigurationError extends BaseError {
1344
+ constructor(message: string, details?: any);
1345
+ }
1237
1346
  /**
1238
- * Escape regular expression special characters
1347
+ * Network error
1239
1348
  */
1240
- declare function escapeRegExp(str: string): string;
1349
+ declare class NetworkError extends BaseError {
1350
+ constructor(message: string, details?: any);
1351
+ }
1241
1352
  /**
1242
- * Generate random string
1353
+ * Check if error is of specific type
1243
1354
  */
1244
- declare function randomString(length: number, charset?: string): string;
1355
+ declare function isErrorType<T extends Error>(error: unknown, errorClass: new (...args: any[]) => T): error is T;
1245
1356
  /**
1246
- * Generate UUID v4
1357
+ * Get error message safely
1247
1358
  */
1248
- declare function uuid(): string;
1359
+ declare function getErrorMessage(error: unknown): string;
1249
1360
  /**
1250
- * Slugify string (URL-friendly)
1361
+ * Get error stack safely
1251
1362
  */
1252
- declare function slugify(str: string): string;
1363
+ declare function getErrorStack(error: unknown): string | undefined;
1253
1364
  /**
1254
- * Extract numbers from string
1365
+ * Format error for logging
1255
1366
  */
1256
- declare function extractNumbers(str: string): number[];
1367
+ declare function formatError(error: unknown): {
1368
+ message: string;
1369
+ name?: string;
1370
+ code?: string;
1371
+ statusCode?: number;
1372
+ stack?: string;
1373
+ details?: any;
1374
+ };
1257
1375
  /**
1258
- * Format template string with values
1376
+ * Wrap error with additional context
1259
1377
  */
1260
- declare function template(str: string, values: Record<string, any>): string;
1378
+ declare function wrapError(error: unknown, message: string, code?: string): BaseError;
1261
1379
  /**
1262
- * Repeat string n times
1380
+ * Try-catch wrapper that returns result or error
1263
1381
  */
1264
- declare function repeat(str: string, count: number): string;
1382
+ declare function tryCatch<T>(fn: () => T): {
1383
+ success: true;
1384
+ data: T;
1385
+ } | {
1386
+ success: false;
1387
+ error: Error;
1388
+ };
1265
1389
  /**
1266
- * Check if string is empty or only whitespace
1390
+ * Async try-catch wrapper
1267
1391
  */
1268
- declare function isBlank(str: string): boolean;
1392
+ declare function tryCatchAsync<T>(fn: () => Promise<T>): Promise<{
1393
+ success: true;
1394
+ data: T;
1395
+ } | {
1396
+ success: false;
1397
+ error: Error;
1398
+ }>;
1269
1399
  /**
1270
- * Ensure string ends with suffix
1400
+ * Assert condition or throw error
1271
1401
  */
1272
- declare function ensureSuffix(str: string, suffix: string): string;
1402
+ declare function assert$1(condition: boolean, message: string, ErrorClass?: new (message: string) => Error): asserts condition;
1273
1403
  /**
1274
- * Ensure string starts with prefix
1404
+ * Create error handler
1275
1405
  */
1276
- declare function ensurePrefix(str: string, prefix: string): string;
1406
+ declare function createErrorHandler(handlers: Record<string, (error: Error) => void>, defaultHandler?: (error: Error) => void): (error: unknown) => void;
1277
1407
  /**
1278
- * Remove prefix from string
1408
+ * Aggregate multiple errors
1279
1409
  */
1280
- declare function removePrefix(str: string, prefix: string): string;
1410
+ declare class AggregateError extends BaseError {
1411
+ readonly errors: Error[];
1412
+ constructor(errors: Error[], message?: string);
1413
+ static fromErrors(errors: Error[]): AggregateError;
1414
+ }
1281
1415
  /**
1282
- * Remove suffix from string
1416
+ * Retry with error handling
1283
1417
  */
1284
- declare function removeSuffix(str: string, suffix: string): string;
1418
+ declare function retryWithErrorHandling<T>(fn: () => Promise<T>, options?: {
1419
+ maxAttempts?: number;
1420
+ delay?: number;
1421
+ shouldRetry?: (error: Error) => boolean;
1422
+ onError?: (error: Error, attempt: number) => void;
1423
+ }): Promise<T>;
1285
1424
 
1286
1425
  /**
1287
- * String Utilities
1288
- * String manipulation and formatting
1426
+ * Error Utilities
1427
+ * Error handling and custom error classes
1289
1428
  */
1290
1429
 
1291
- declare const index$4_camelCase: typeof camelCase;
1292
- declare const index$4_capitalize: typeof capitalize;
1293
- declare const index$4_constantCase: typeof constantCase;
1294
- declare const index$4_contains: typeof contains;
1295
- declare const index$4_countOccurrences: typeof countOccurrences;
1296
- declare const index$4_endsWith: typeof endsWith;
1297
- declare const index$4_ensurePrefix: typeof ensurePrefix;
1298
- declare const index$4_ensureSuffix: typeof ensureSuffix;
1299
- declare const index$4_escapeHTML: typeof escapeHTML;
1300
- declare const index$4_escapeRegExp: typeof escapeRegExp;
1301
- declare const index$4_extractNumbers: typeof extractNumbers;
1302
- declare const index$4_isBlank: typeof isBlank;
1303
- declare const index$4_join: typeof join;
1304
- declare const index$4_kebabCase: typeof kebabCase;
1305
- declare const index$4_normalizeWhitespace: typeof normalizeWhitespace;
1306
- declare const index$4_pad: typeof pad;
1307
- declare const index$4_pascalCase: typeof pascalCase;
1308
- declare const index$4_randomString: typeof randomString;
1309
- declare const index$4_removePrefix: typeof removePrefix;
1310
- declare const index$4_removeSuffix: typeof removeSuffix;
1311
- declare const index$4_removeWhitespace: typeof removeWhitespace;
1312
- declare const index$4_repeat: typeof repeat;
1313
- declare const index$4_replaceAll: typeof replaceAll;
1314
- declare const index$4_reverse: typeof reverse;
1315
- declare const index$4_sentenceCase: typeof sentenceCase;
1316
- declare const index$4_slugify: typeof slugify;
1317
- declare const index$4_snakeCase: typeof snakeCase;
1318
- declare const index$4_split: typeof split;
1319
- declare const index$4_startsWith: typeof startsWith;
1320
- declare const index$4_template: typeof template;
1321
- declare const index$4_titleCase: typeof titleCase;
1322
- declare const index$4_trim: typeof trim;
1323
- declare const index$4_trimEnd: typeof trimEnd;
1324
- declare const index$4_trimStart: typeof trimStart;
1325
- declare const index$4_truncate: typeof truncate;
1326
- declare const index$4_unescapeHTML: typeof unescapeHTML;
1327
- declare const index$4_uuid: typeof uuid;
1328
- declare const index$4_wordCount: typeof wordCount;
1329
- declare const index$4_words: typeof words;
1330
- declare namespace index$4 {
1430
+ type index$3_AggregateError = AggregateError;
1431
+ declare const index$3_AggregateError: typeof AggregateError;
1432
+ type index$3_BaseError = BaseError;
1433
+ declare const index$3_BaseError: typeof BaseError;
1434
+ type index$3_ConfigurationError = ConfigurationError;
1435
+ declare const index$3_ConfigurationError: typeof ConfigurationError;
1436
+ type index$3_ConflictError = ConflictError;
1437
+ declare const index$3_ConflictError: typeof ConflictError;
1438
+ type index$3_ForbiddenError = ForbiddenError;
1439
+ declare const index$3_ForbiddenError: typeof ForbiddenError;
1440
+ type index$3_InternalError = InternalError;
1441
+ declare const index$3_InternalError: typeof InternalError;
1442
+ type index$3_NetworkError = NetworkError;
1443
+ declare const index$3_NetworkError: typeof NetworkError;
1444
+ type index$3_NotFoundError = NotFoundError;
1445
+ declare const index$3_NotFoundError: typeof NotFoundError;
1446
+ type index$3_TimeoutError = TimeoutError;
1447
+ declare const index$3_TimeoutError: typeof TimeoutError;
1448
+ type index$3_UnauthorizedError = UnauthorizedError;
1449
+ declare const index$3_UnauthorizedError: typeof UnauthorizedError;
1450
+ type index$3_ValidationError = ValidationError;
1451
+ declare const index$3_ValidationError: typeof ValidationError;
1452
+ declare const index$3_createErrorHandler: typeof createErrorHandler;
1453
+ declare const index$3_formatError: typeof formatError;
1454
+ declare const index$3_getErrorMessage: typeof getErrorMessage;
1455
+ declare const index$3_getErrorStack: typeof getErrorStack;
1456
+ declare const index$3_isErrorType: typeof isErrorType;
1457
+ declare const index$3_retryWithErrorHandling: typeof retryWithErrorHandling;
1458
+ declare const index$3_tryCatch: typeof tryCatch;
1459
+ declare const index$3_tryCatchAsync: typeof tryCatchAsync;
1460
+ declare const index$3_wrapError: typeof wrapError;
1461
+ declare namespace index$3 {
1331
1462
  export {
1332
- index$4_camelCase as camelCase,
1333
- index$4_capitalize as capitalize,
1334
- index$4_constantCase as constantCase,
1335
- index$4_contains as contains,
1336
- index$4_countOccurrences as countOccurrences,
1337
- index$4_endsWith as endsWith,
1338
- index$4_ensurePrefix as ensurePrefix,
1339
- index$4_ensureSuffix as ensureSuffix,
1340
- index$4_escapeHTML as escapeHTML,
1341
- index$4_escapeRegExp as escapeRegExp,
1342
- index$4_extractNumbers as extractNumbers,
1343
- index$4_isBlank as isBlank,
1344
- index$4_join as join,
1345
- index$4_kebabCase as kebabCase,
1346
- index$4_normalizeWhitespace as normalizeWhitespace,
1347
- index$4_pad as pad,
1348
- index$4_pascalCase as pascalCase,
1349
- index$4_randomString as randomString,
1350
- index$4_removePrefix as removePrefix,
1351
- index$4_removeSuffix as removeSuffix,
1352
- index$4_removeWhitespace as removeWhitespace,
1353
- index$4_repeat as repeat,
1354
- index$4_replaceAll as replaceAll,
1355
- index$4_reverse as reverse,
1356
- index$4_sentenceCase as sentenceCase,
1357
- index$4_slugify as slugify,
1358
- index$4_snakeCase as snakeCase,
1359
- index$4_split as split,
1360
- index$4_startsWith as startsWith,
1361
- index$4_template as template,
1362
- index$4_titleCase as titleCase,
1363
- index$4_trim as trim,
1364
- index$4_trimEnd as trimEnd,
1365
- index$4_trimStart as trimStart,
1366
- index$4_truncate as truncate,
1367
- index$4_unescapeHTML as unescapeHTML,
1368
- index$4_uuid as uuid,
1369
- index$4_wordCount as wordCount,
1370
- index$4_words as words,
1463
+ index$3_AggregateError as AggregateError,
1464
+ index$3_BaseError as BaseError,
1465
+ index$3_ConfigurationError as ConfigurationError,
1466
+ index$3_ConflictError as ConflictError,
1467
+ index$3_ForbiddenError as ForbiddenError,
1468
+ index$3_InternalError as InternalError,
1469
+ index$3_NetworkError as NetworkError,
1470
+ index$3_NotFoundError as NotFoundError,
1471
+ index$3_TimeoutError as TimeoutError,
1472
+ index$3_UnauthorizedError as UnauthorizedError,
1473
+ index$3_ValidationError as ValidationError,
1474
+ assert$1 as assert,
1475
+ index$3_createErrorHandler as createErrorHandler,
1476
+ index$3_formatError as formatError,
1477
+ index$3_getErrorMessage as getErrorMessage,
1478
+ index$3_getErrorStack as getErrorStack,
1479
+ index$3_isErrorType as isErrorType,
1480
+ index$3_retryWithErrorHandling as retryWithErrorHandling,
1481
+ index$3_tryCatch as tryCatch,
1482
+ index$3_tryCatchAsync as tryCatchAsync,
1483
+ index$3_wrapError as wrapError,
1371
1484
  };
1372
1485
  }
1373
1486
 
1374
1487
  /**
1375
- * Object Utilities
1376
- * Object manipulation and transformation functions
1488
+ * File System Utilities
1489
+ * Provides utilities for file system operations
1490
+ */
1491
+ /**
1492
+ * Check if a file or directory exists
1377
1493
  */
1494
+ declare function exists(filePath: string): Promise<boolean>;
1378
1495
  /**
1379
- * Deep clone an object
1496
+ * Check if path is a file
1380
1497
  */
1381
- declare function deepClone<T>(obj: T): T;
1498
+ declare function isFile(filePath: string): Promise<boolean>;
1382
1499
  /**
1383
- * Deep merge two objects
1500
+ * Check if path is a directory
1384
1501
  */
1385
- declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
1502
+ declare function isDirectory(filePath: string): Promise<boolean>;
1386
1503
  /**
1387
- * Get nested property value using dot notation
1504
+ * Create directory recursively
1388
1505
  */
1389
- declare function get<T = any>(obj: any, path: string, defaultValue?: T): T | undefined;
1506
+ declare function ensureDir(dirPath: string): Promise<void>;
1390
1507
  /**
1391
- * Set nested property value using dot notation
1508
+ * Read file as string
1392
1509
  */
1393
- declare function set(obj: any, path: string, value: any): void;
1510
+ declare function readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
1394
1511
  /**
1395
- * Check if object has nested property using dot notation
1512
+ * Write file with content
1396
1513
  */
1397
- declare function has(obj: any, path: string): boolean;
1514
+ declare function writeFile(filePath: string, content: string, encoding?: BufferEncoding): Promise<void>;
1398
1515
  /**
1399
- * Delete nested property using dot notation
1516
+ * Append content to file
1400
1517
  */
1401
- declare function unset(obj: any, path: string): boolean;
1518
+ declare function appendFile(filePath: string, content: string, encoding?: BufferEncoding): Promise<void>;
1402
1519
  /**
1403
- * Get all keys from object (including nested)
1520
+ * Read JSON file
1404
1521
  */
1405
- declare function keys(obj: any, prefix?: string): string[];
1522
+ declare function readJSON<T = any>(filePath: string): Promise<T>;
1406
1523
  /**
1407
- * Get all values from object
1524
+ * Write JSON file
1408
1525
  */
1409
- declare function values<T = any>(obj: Record<string, T>): T[];
1526
+ declare function writeJSON(filePath: string, data: any, pretty?: boolean): Promise<void>;
1410
1527
  /**
1411
- * Get all entries from object
1528
+ * Copy file
1412
1529
  */
1413
- declare function entries<T = any>(obj: Record<string, T>): [string, T][];
1530
+ declare function copyFile(src: string, dest: string): Promise<void>;
1414
1531
  /**
1415
- * Pick specific keys from object
1532
+ * Move/rename file
1416
1533
  */
1417
- declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
1534
+ declare function moveFile(src: string, dest: string): Promise<void>;
1418
1535
  /**
1419
- * Omit specific keys from object
1536
+ * Delete file
1420
1537
  */
1421
- declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
1538
+ declare function deleteFile(filePath: string): Promise<void>;
1422
1539
  /**
1423
- * Filter object by predicate
1540
+ * Delete directory recursively
1424
1541
  */
1425
- declare function filter<T>(obj: Record<string, T>, predicate: (value: T, key: string) => boolean): Record<string, T>;
1542
+ declare function deleteDir(dirPath: string): Promise<void>;
1426
1543
  /**
1427
- * Map object values
1544
+ * List files in directory
1428
1545
  */
1429
- declare function map<T, U>(obj: Record<string, T>, mapper: (value: T, key: string) => U): Record<string, U>;
1546
+ declare function listFiles(dirPath: string, recursive?: boolean): Promise<string[]>;
1430
1547
  /**
1431
- * Check if object is empty
1548
+ * List directories in directory
1432
1549
  */
1433
- declare function isEmpty$1(obj: object): boolean;
1550
+ declare function listDirs(dirPath: string): Promise<string[]>;
1434
1551
  /**
1435
- * Flatten nested object
1552
+ * Get file size in bytes
1436
1553
  */
1437
- declare function flatten$1(obj: any, prefix?: string, separator?: string): Record<string, any>;
1554
+ declare function getFileSize(filePath: string): Promise<number>;
1438
1555
  /**
1439
- * Unflatten object (reverse of flatten)
1556
+ * Get file modification time
1440
1557
  */
1441
- declare function unflatten(obj: Record<string, any>, separator?: string): any;
1558
+ declare function getModifiedTime(filePath: string): Promise<Date>;
1442
1559
  /**
1443
- * Invert object (swap keys and values)
1560
+ * Get file creation time
1444
1561
  */
1445
- declare function invert<T extends string | number>(obj: Record<string, T>): Record<T, string>;
1562
+ declare function getCreatedTime(filePath: string): Promise<Date>;
1446
1563
  /**
1447
- * Group array of objects by key
1564
+ * Check if file is readable
1448
1565
  */
1449
- declare function groupBy<T>(arr: T[], key: keyof T | ((item: T) => string)): Record<string, T[]>;
1566
+ declare function isReadable(filePath: string): Promise<boolean>;
1450
1567
  /**
1451
- * Convert array to object using key selector
1568
+ * Check if file is writable
1452
1569
  */
1453
- declare function keyBy<T>(arr: T[], key: keyof T | ((item: T) => string)): Record<string, T>;
1570
+ declare function isWritable(filePath: string): Promise<boolean>;
1454
1571
  /**
1455
- * Check if two objects are deeply equal
1572
+ * Check if file is executable
1456
1573
  */
1457
- declare function isEqual$1(obj1: any, obj2: any): boolean;
1574
+ declare function isExecutable(filePath: string): Promise<boolean>;
1458
1575
  /**
1459
- * Remove null and undefined values from object
1576
+ * Find files matching pattern
1460
1577
  */
1461
- declare function compact$1<T extends object>(obj: T): Partial<T>;
1578
+ declare function findFiles(dirPath: string, pattern: RegExp | string, recursive?: boolean): Promise<string[]>;
1462
1579
  /**
1463
- * Freeze object deeply (immutable)
1580
+ * Get directory size (total size of all files)
1464
1581
  */
1465
- declare function deepFreeze<T>(obj: T): Readonly<T>;
1582
+ declare function getDirSize(dirPath: string): Promise<number>;
1466
1583
  /**
1467
- * Merge multiple objects
1584
+ * Copy directory recursively
1468
1585
  */
1469
- declare function merge<T extends object>(...objects: Partial<T>[]): T;
1586
+ declare function copyDir(src: string, dest: string): Promise<void>;
1470
1587
  /**
1471
- * Get object size (number of keys)
1588
+ * Empty directory (delete all contents but keep directory)
1472
1589
  */
1473
- declare function size(obj: object): number;
1590
+ declare function emptyDir(dirPath: string): Promise<void>;
1474
1591
 
1475
1592
  /**
1476
- * Object Utilities
1477
- * Object manipulation and transformation
1593
+ * File System Utilities
1594
+ * File and directory operations
1478
1595
  */
1479
1596
 
1480
- declare const index$3_deepClone: typeof deepClone;
1481
- declare const index$3_deepFreeze: typeof deepFreeze;
1482
- declare const index$3_deepMerge: typeof deepMerge;
1483
- declare const index$3_entries: typeof entries;
1484
- declare const index$3_filter: typeof filter;
1485
- declare const index$3_get: typeof get;
1486
- declare const index$3_groupBy: typeof groupBy;
1487
- declare const index$3_has: typeof has;
1488
- declare const index$3_invert: typeof invert;
1489
- declare const index$3_keyBy: typeof keyBy;
1490
- declare const index$3_keys: typeof keys;
1491
- declare const index$3_map: typeof map;
1492
- declare const index$3_merge: typeof merge;
1493
- declare const index$3_omit: typeof omit;
1494
- declare const index$3_pick: typeof pick;
1495
- declare const index$3_set: typeof set;
1496
- declare const index$3_size: typeof size;
1497
- declare const index$3_unflatten: typeof unflatten;
1498
- declare const index$3_unset: typeof unset;
1499
- declare const index$3_values: typeof values;
1500
- declare namespace index$3 {
1597
+ declare const index$2_appendFile: typeof appendFile;
1598
+ declare const index$2_copyDir: typeof copyDir;
1599
+ declare const index$2_copyFile: typeof copyFile;
1600
+ declare const index$2_deleteDir: typeof deleteDir;
1601
+ declare const index$2_deleteFile: typeof deleteFile;
1602
+ declare const index$2_emptyDir: typeof emptyDir;
1603
+ declare const index$2_ensureDir: typeof ensureDir;
1604
+ declare const index$2_exists: typeof exists;
1605
+ declare const index$2_findFiles: typeof findFiles;
1606
+ declare const index$2_getCreatedTime: typeof getCreatedTime;
1607
+ declare const index$2_getDirSize: typeof getDirSize;
1608
+ declare const index$2_getFileSize: typeof getFileSize;
1609
+ declare const index$2_getModifiedTime: typeof getModifiedTime;
1610
+ declare const index$2_isDirectory: typeof isDirectory;
1611
+ declare const index$2_isExecutable: typeof isExecutable;
1612
+ declare const index$2_isFile: typeof isFile;
1613
+ declare const index$2_isReadable: typeof isReadable;
1614
+ declare const index$2_isWritable: typeof isWritable;
1615
+ declare const index$2_listDirs: typeof listDirs;
1616
+ declare const index$2_listFiles: typeof listFiles;
1617
+ declare const index$2_moveFile: typeof moveFile;
1618
+ declare const index$2_readFile: typeof readFile;
1619
+ declare const index$2_readJSON: typeof readJSON;
1620
+ declare const index$2_writeFile: typeof writeFile;
1621
+ declare const index$2_writeJSON: typeof writeJSON;
1622
+ declare namespace index$2 {
1501
1623
  export {
1502
- compact$1 as compact,
1503
- index$3_deepClone as deepClone,
1504
- index$3_deepFreeze as deepFreeze,
1505
- index$3_deepMerge as deepMerge,
1506
- index$3_entries as entries,
1507
- index$3_filter as filter,
1508
- flatten$1 as flatten,
1509
- index$3_get as get,
1510
- index$3_groupBy as groupBy,
1511
- index$3_has as has,
1512
- index$3_invert as invert,
1513
- isEmpty$1 as isEmpty,
1514
- isEqual$1 as isEqual,
1515
- index$3_keyBy as keyBy,
1516
- index$3_keys as keys,
1517
- index$3_map as map,
1518
- index$3_merge as merge,
1519
- index$3_omit as omit,
1520
- index$3_pick as pick,
1521
- index$3_set as set,
1522
- index$3_size as size,
1523
- index$3_unflatten as unflatten,
1524
- index$3_unset as unset,
1525
- index$3_values as values,
1624
+ index$2_appendFile as appendFile,
1625
+ index$2_copyDir as copyDir,
1626
+ index$2_copyFile as copyFile,
1627
+ index$2_deleteDir as deleteDir,
1628
+ index$2_deleteFile as deleteFile,
1629
+ index$2_emptyDir as emptyDir,
1630
+ index$2_ensureDir as ensureDir,
1631
+ index$2_exists as exists,
1632
+ index$2_findFiles as findFiles,
1633
+ index$2_getCreatedTime as getCreatedTime,
1634
+ index$2_getDirSize as getDirSize,
1635
+ index$2_getFileSize as getFileSize,
1636
+ index$2_getModifiedTime as getModifiedTime,
1637
+ index$2_isDirectory as isDirectory,
1638
+ index$2_isExecutable as isExecutable,
1639
+ index$2_isFile as isFile,
1640
+ index$2_isReadable as isReadable,
1641
+ index$2_isWritable as isWritable,
1642
+ index$2_listDirs as listDirs,
1643
+ index$2_listFiles as listFiles,
1644
+ index$2_moveFile as moveFile,
1645
+ index$2_readFile as readFile,
1646
+ index$2_readJSON as readJSON,
1647
+ index$2_writeFile as writeFile,
1648
+ index$2_writeJSON as writeJSON,
1526
1649
  };
1527
1650
  }
1528
1651
 
1529
1652
  /**
1530
- * Array Utilities
1531
- * Array manipulation and transformation functions
1532
- */
1533
- /**
1534
- * Remove duplicates from array
1535
- */
1536
- declare function unique<T>(arr: T[]): T[];
1537
- /**
1538
- * Remove duplicates by key
1539
- */
1540
- declare function uniqueBy<T>(arr: T[], key: keyof T | ((item: T) => any)): T[];
1541
- /**
1542
- * Flatten nested array
1543
- */
1544
- declare function flatten<T>(arr: any[], depth?: number): T[];
1545
- /**
1546
- * Chunk array into smaller arrays
1547
- */
1548
- declare function chunk<T>(arr: T[], size: number): T[][];
1549
- /**
1550
- * Shuffle array randomly
1551
- */
1552
- declare function shuffle<T>(arr: T[]): T[];
1553
- /**
1554
- * Get random element from array
1555
- */
1556
- declare function sample<T>(arr: T[]): T | undefined;
1557
- /**
1558
- * Get multiple random elements from array
1559
- */
1560
- declare function sampleSize<T>(arr: T[], size: number): T[];
1561
- /**
1562
- * Partition array into two arrays based on predicate
1653
+ * CCJK Logger - MUD Style
1654
+ *
1655
+ * Structured logging with terminal green aesthetics
1563
1656
  */
1564
- declare function partition<T>(arr: T[], predicate: (item: T) => boolean): [T[], T[]];
1657
+ type LogLevel$1 = 'debug' | 'info' | 'warn' | 'error';
1658
+ interface LoggerOptions$1 {
1659
+ level?: LogLevel$1;
1660
+ silent?: boolean;
1661
+ }
1662
+ declare class Logger$1 {
1663
+ private level;
1664
+ private silent;
1665
+ private levels;
1666
+ constructor(options?: LoggerOptions$1);
1667
+ private shouldLog;
1668
+ private format;
1669
+ /** MUD-style color scheme for log levels */
1670
+ private colorize;
1671
+ debug(message: string, data?: unknown): void;
1672
+ info(message: string, data?: unknown): void;
1673
+ warn(message: string, data?: unknown): void;
1674
+ error(message: string, data?: unknown): void;
1675
+ setLevel(level: LogLevel$1): void;
1676
+ setSilent(silent: boolean): void;
1677
+ }
1678
+ declare const logger$1: Logger$1;
1679
+
1680
+ declare namespace logger$2 {
1681
+ export { Logger$1 as Logger, logger$1 as logger };
1682
+ export type { LogLevel$1 as LogLevel, LoggerOptions$1 as LoggerOptions };
1683
+ }
1684
+
1565
1685
  /**
1566
- * Get intersection of arrays
1686
+ * Logger Utilities
1687
+ * Simple logging utilities
1567
1688
  */
1568
- declare function intersection<T>(...arrays: T[][]): T[];
1689
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
1690
+ interface LoggerOptions {
1691
+ level?: LogLevel;
1692
+ prefix?: string;
1693
+ timestamp?: boolean;
1694
+ colors?: boolean;
1695
+ }
1569
1696
  /**
1570
- * Get union of arrays
1697
+ * Simple logger class
1571
1698
  */
1572
- declare function union<T>(...arrays: T[][]): T[];
1699
+ declare class Logger {
1700
+ private level;
1701
+ private prefix;
1702
+ private timestamp;
1703
+ private colors;
1704
+ constructor(options?: LoggerOptions);
1705
+ private shouldLog;
1706
+ private formatMessage;
1707
+ private stringify;
1708
+ debug(message: string, ...args: any[]): void;
1709
+ info(message: string, ...args: any[]): void;
1710
+ warn(message: string, ...args: any[]): void;
1711
+ error(message: string, ...args: any[]): void;
1712
+ setLevel(level: LogLevel): void;
1713
+ getLevel(): LogLevel;
1714
+ }
1573
1715
  /**
1574
- * Get difference between arrays (items in first but not in others)
1716
+ * Create a logger instance
1575
1717
  */
1576
- declare function difference<T>(arr: T[], ...others: T[][]): T[];
1718
+ declare function createLogger(options?: LoggerOptions): Logger;
1577
1719
  /**
1578
- * Zip arrays together
1720
+ * Default logger instance
1579
1721
  */
1580
- declare function zip<T>(...arrays: T[][]): T[][];
1722
+ declare const logger: Logger;
1723
+
1581
1724
  /**
1582
- * Unzip array of arrays
1725
+ * Object Utilities
1726
+ * Object manipulation and transformation functions
1583
1727
  */
1584
- declare function unzip<T>(arr: T[][]): T[][];
1585
1728
  /**
1586
- * Group consecutive elements
1729
+ * Deep clone an object
1587
1730
  */
1588
- declare function groupConsecutive<T>(arr: T[], predicate: (a: T, b: T) => boolean): T[][];
1731
+ declare function deepClone<T>(obj: T): T;
1589
1732
  /**
1590
- * Take first n elements
1733
+ * Deep merge two objects
1591
1734
  */
1592
- declare function take<T>(arr: T[], n: number): T[];
1735
+ declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
1593
1736
  /**
1594
- * Take last n elements
1737
+ * Get nested property value using dot notation
1595
1738
  */
1596
- declare function takeLast<T>(arr: T[], n: number): T[];
1739
+ declare function get<T = any>(obj: any, path: string, defaultValue?: T): T | undefined;
1597
1740
  /**
1598
- * Drop first n elements
1741
+ * Set nested property value using dot notation
1599
1742
  */
1600
- declare function drop<T>(arr: T[], n: number): T[];
1743
+ declare function set(obj: any, path: string, value: any): void;
1601
1744
  /**
1602
- * Drop last n elements
1745
+ * Check if object has nested property using dot notation
1603
1746
  */
1604
- declare function dropLast<T>(arr: T[], n: number): T[];
1747
+ declare function has(obj: any, path: string): boolean;
1605
1748
  /**
1606
- * Take elements while predicate is true
1749
+ * Delete nested property using dot notation
1607
1750
  */
1608
- declare function takeWhile<T>(arr: T[], predicate: (item: T) => boolean): T[];
1751
+ declare function unset(obj: any, path: string): boolean;
1609
1752
  /**
1610
- * Drop elements while predicate is true
1753
+ * Get all keys from object (including nested)
1611
1754
  */
1612
- declare function dropWhile<T>(arr: T[], predicate: (item: T) => boolean): T[];
1755
+ declare function keys(obj: any, prefix?: string): string[];
1613
1756
  /**
1614
- * Find index of element
1757
+ * Get all values from object
1615
1758
  */
1616
- declare function findIndex<T>(arr: T[], predicate: (item: T) => boolean): number;
1759
+ declare function values<T = any>(obj: Record<string, T>): T[];
1617
1760
  /**
1618
- * Find last index of element
1761
+ * Get all entries from object
1619
1762
  */
1620
- declare function findLastIndex<T>(arr: T[], predicate: (item: T) => boolean): number;
1763
+ declare function entries<T = any>(obj: Record<string, T>): [string, T][];
1621
1764
  /**
1622
- * Count occurrences of element
1765
+ * Pick specific keys from object
1623
1766
  */
1624
- declare function count<T>(arr: T[], item: T): number;
1767
+ declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
1625
1768
  /**
1626
- * Count elements matching predicate
1769
+ * Omit specific keys from object
1627
1770
  */
1628
- declare function countBy<T>(arr: T[], predicate: (item: T) => boolean): number;
1771
+ declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
1629
1772
  /**
1630
- * Sum array of numbers
1773
+ * Filter object by predicate
1631
1774
  */
1632
- declare function sum(arr: number[]): number;
1775
+ declare function filter<T>(obj: Record<string, T>, predicate: (value: T, key: string) => boolean): Record<string, T>;
1633
1776
  /**
1634
- * Sum by property or function
1777
+ * Map object values
1635
1778
  */
1636
- declare function sumBy<T>(arr: T[], selector: keyof T | ((item: T) => number)): number;
1779
+ declare function map<T, U>(obj: Record<string, T>, mapper: (value: T, key: string) => U): Record<string, U>;
1637
1780
  /**
1638
- * Get average of numbers
1781
+ * Check if object is empty
1639
1782
  */
1640
- declare function average(arr: number[]): number;
1783
+ declare function isEmpty(obj: object): boolean;
1641
1784
  /**
1642
- * Get minimum value
1785
+ * Flatten nested object
1643
1786
  */
1644
- declare function min(arr: number[]): number | undefined;
1787
+ declare function flatten(obj: any, prefix?: string, separator?: string): Record<string, any>;
1645
1788
  /**
1646
- * Get maximum value
1789
+ * Unflatten object (reverse of flatten)
1647
1790
  */
1648
- declare function max(arr: number[]): number | undefined;
1791
+ declare function unflatten(obj: Record<string, any>, separator?: string): any;
1649
1792
  /**
1650
- * Get minimum by property or function
1793
+ * Invert object (swap keys and values)
1651
1794
  */
1652
- declare function minBy<T>(arr: T[], selector: keyof T | ((item: T) => number)): T | undefined;
1795
+ declare function invert<T extends string | number>(obj: Record<string, T>): Record<T, string>;
1653
1796
  /**
1654
- * Get maximum by property or function
1797
+ * Group array of objects by key
1655
1798
  */
1656
- declare function maxBy<T>(arr: T[], selector: keyof T | ((item: T) => number)): T | undefined;
1799
+ declare function groupBy<T>(arr: T[], key: keyof T | ((item: T) => string)): Record<string, T[]>;
1657
1800
  /**
1658
- * Sort array by property or function
1801
+ * Convert array to object using key selector
1659
1802
  */
1660
- declare function sortBy<T>(arr: T[], selector: keyof T | ((item: T) => any), order?: 'asc' | 'desc'): T[];
1803
+ declare function keyBy<T>(arr: T[], key: keyof T | ((item: T) => string)): Record<string, T>;
1661
1804
  /**
1662
- * Check if array is empty
1805
+ * Check if two objects are deeply equal
1663
1806
  */
1664
- declare function isEmpty<T>(arr: T[]): boolean;
1807
+ declare function isEqual(obj1: any, obj2: any): boolean;
1665
1808
  /**
1666
- * Compact array (remove falsy values)
1809
+ * Remove null and undefined values from object
1667
1810
  */
1668
- declare function compact<T>(arr: T[]): NonNullable<T>[];
1811
+ declare function compact<T extends object>(obj: T): Partial<T>;
1669
1812
  /**
1670
- * Range of numbers
1813
+ * Freeze object deeply (immutable)
1671
1814
  */
1672
- declare function range(start: number, end?: number, step?: number): number[];
1815
+ declare function deepFreeze<T>(obj: T): Readonly<T>;
1673
1816
  /**
1674
- * Rotate array by n positions
1817
+ * Merge multiple objects
1675
1818
  */
1676
- declare function rotate<T>(arr: T[], n: number): T[];
1819
+ declare function merge<T extends object>(...objects: Partial<T>[]): T;
1677
1820
  /**
1678
- * Check if arrays are equal
1821
+ * Get object size (number of keys)
1679
1822
  */
1680
- declare function isEqual<T>(arr1: T[], arr2: T[]): boolean;
1823
+ declare function size(obj: object): number;
1681
1824
 
1682
1825
  /**
1683
- * Array Utilities
1684
- * Array manipulation and transformation
1826
+ * Object Utilities
1827
+ * Object manipulation and transformation
1685
1828
  */
1686
1829
 
1687
- declare const index$2_average: typeof average;
1688
- declare const index$2_chunk: typeof chunk;
1689
- declare const index$2_compact: typeof compact;
1690
- declare const index$2_count: typeof count;
1691
- declare const index$2_countBy: typeof countBy;
1692
- declare const index$2_difference: typeof difference;
1693
- declare const index$2_drop: typeof drop;
1694
- declare const index$2_dropLast: typeof dropLast;
1695
- declare const index$2_dropWhile: typeof dropWhile;
1696
- declare const index$2_findIndex: typeof findIndex;
1697
- declare const index$2_findLastIndex: typeof findLastIndex;
1698
- declare const index$2_flatten: typeof flatten;
1699
- declare const index$2_groupConsecutive: typeof groupConsecutive;
1700
- declare const index$2_intersection: typeof intersection;
1701
- declare const index$2_isEmpty: typeof isEmpty;
1702
- declare const index$2_isEqual: typeof isEqual;
1703
- declare const index$2_max: typeof max;
1704
- declare const index$2_maxBy: typeof maxBy;
1705
- declare const index$2_min: typeof min;
1706
- declare const index$2_minBy: typeof minBy;
1707
- declare const index$2_partition: typeof partition;
1708
- declare const index$2_range: typeof range;
1709
- declare const index$2_rotate: typeof rotate;
1710
- declare const index$2_sample: typeof sample;
1711
- declare const index$2_sampleSize: typeof sampleSize;
1712
- declare const index$2_shuffle: typeof shuffle;
1713
- declare const index$2_sortBy: typeof sortBy;
1714
- declare const index$2_sum: typeof sum;
1715
- declare const index$2_sumBy: typeof sumBy;
1716
- declare const index$2_take: typeof take;
1717
- declare const index$2_takeLast: typeof takeLast;
1718
- declare const index$2_takeWhile: typeof takeWhile;
1719
- declare const index$2_union: typeof union;
1720
- declare const index$2_unique: typeof unique;
1721
- declare const index$2_uniqueBy: typeof uniqueBy;
1722
- declare const index$2_unzip: typeof unzip;
1723
- declare const index$2_zip: typeof zip;
1724
- declare namespace index$2 {
1830
+ declare const index$1_compact: typeof compact;
1831
+ declare const index$1_deepClone: typeof deepClone;
1832
+ declare const index$1_deepFreeze: typeof deepFreeze;
1833
+ declare const index$1_deepMerge: typeof deepMerge;
1834
+ declare const index$1_entries: typeof entries;
1835
+ declare const index$1_filter: typeof filter;
1836
+ declare const index$1_flatten: typeof flatten;
1837
+ declare const index$1_get: typeof get;
1838
+ declare const index$1_groupBy: typeof groupBy;
1839
+ declare const index$1_has: typeof has;
1840
+ declare const index$1_invert: typeof invert;
1841
+ declare const index$1_isEmpty: typeof isEmpty;
1842
+ declare const index$1_isEqual: typeof isEqual;
1843
+ declare const index$1_keyBy: typeof keyBy;
1844
+ declare const index$1_keys: typeof keys;
1845
+ declare const index$1_map: typeof map;
1846
+ declare const index$1_merge: typeof merge;
1847
+ declare const index$1_omit: typeof omit;
1848
+ declare const index$1_pick: typeof pick;
1849
+ declare const index$1_set: typeof set;
1850
+ declare const index$1_size: typeof size;
1851
+ declare const index$1_unflatten: typeof unflatten;
1852
+ declare const index$1_unset: typeof unset;
1853
+ declare const index$1_values: typeof values;
1854
+ declare namespace index$1 {
1725
1855
  export {
1726
- index$2_average as average,
1727
- index$2_chunk as chunk,
1728
- index$2_compact as compact,
1729
- index$2_count as count,
1730
- index$2_countBy as countBy,
1731
- index$2_difference as difference,
1732
- index$2_drop as drop,
1733
- index$2_dropLast as dropLast,
1734
- index$2_dropWhile as dropWhile,
1735
- index$2_findIndex as findIndex,
1736
- index$2_findLastIndex as findLastIndex,
1737
- index$2_flatten as flatten,
1738
- index$2_groupConsecutive as groupConsecutive,
1739
- index$2_intersection as intersection,
1740
- index$2_isEmpty as isEmpty,
1741
- index$2_isEqual as isEqual,
1742
- index$2_max as max,
1743
- index$2_maxBy as maxBy,
1744
- index$2_min as min,
1745
- index$2_minBy as minBy,
1746
- index$2_partition as partition,
1747
- index$2_range as range,
1748
- index$2_rotate as rotate,
1749
- index$2_sample as sample,
1750
- index$2_sampleSize as sampleSize,
1751
- index$2_shuffle as shuffle,
1752
- index$2_sortBy as sortBy,
1753
- index$2_sum as sum,
1754
- index$2_sumBy as sumBy,
1755
- index$2_take as take,
1756
- index$2_takeLast as takeLast,
1757
- index$2_takeWhile as takeWhile,
1758
- index$2_union as union,
1759
- index$2_unique as unique,
1760
- index$2_uniqueBy as uniqueBy,
1761
- index$2_unzip as unzip,
1762
- index$2_zip as zip,
1856
+ index$1_compact as compact,
1857
+ index$1_deepClone as deepClone,
1858
+ index$1_deepFreeze as deepFreeze,
1859
+ index$1_deepMerge as deepMerge,
1860
+ index$1_entries as entries,
1861
+ index$1_filter as filter,
1862
+ index$1_flatten as flatten,
1863
+ index$1_get as get,
1864
+ index$1_groupBy as groupBy,
1865
+ index$1_has as has,
1866
+ index$1_invert as invert,
1867
+ index$1_isEmpty as isEmpty,
1868
+ index$1_isEqual as isEqual,
1869
+ index$1_keyBy as keyBy,
1870
+ index$1_keys as keys,
1871
+ index$1_map as map,
1872
+ index$1_merge as merge,
1873
+ index$1_omit as omit,
1874
+ index$1_pick as pick,
1875
+ index$1_set as set,
1876
+ index$1_size as size,
1877
+ index$1_unflatten as unflatten,
1878
+ index$1_unset as unset,
1879
+ index$1_values as values,
1763
1880
  };
1764
1881
  }
1765
1882
 
1883
+ declare function getPlatform$1(): 'windows' | 'macos' | 'linux';
1884
+ declare function isTermux(): boolean;
1885
+ declare function getTermuxPrefix(): string;
1886
+ declare function isWindows$1(): boolean;
1887
+ interface WSLInfo {
1888
+ isWSL: true;
1889
+ distro: string | null;
1890
+ version: string | null;
1891
+ }
1892
+ declare function isWSL(): boolean;
1893
+ declare function getWSLDistro(): string | null;
1894
+ declare function getWSLInfo(): WSLInfo | null;
1766
1895
  /**
1767
- * Async Utilities
1768
- * Asynchronous operation helpers
1896
+ * Get MCP command with platform-specific wrapper if needed
1897
+ * @param command - The base command to execute (default: 'npx')
1898
+ * @returns Command array with Windows wrapper if applicable
1769
1899
  */
1900
+ declare function getMcpCommand(command?: string): string[];
1770
1901
  /**
1771
- * Sleep for specified milliseconds
1902
+ * Normalize Windows paths by converting backslashes to forward slashes
1903
+ * This ensures Windows paths like "C:\Program Files\nodejs\npx.cmd" are correctly
1904
+ * written as "C:/Program Files/nodejs/npx.cmd" in TOML format, avoiding escape issues
1905
+ * Unified function used by getSystemRoot() and normalizePath() to avoid code duplication
1906
+ * @param str - The string to normalize (typically a Windows path)
1907
+ * @returns The normalized string with backslashes replaced by forward slashes
1772
1908
  */
1773
- declare function sleep(ms: number): Promise<void>;
1909
+ declare function normalizeTomlPath(str: string): string;
1910
+ declare function getSystemRoot(): string | null;
1911
+ declare function shouldUseSudoForGlobalInstall(): boolean;
1912
+ declare function wrapCommandWithSudo(command: string, args: string[]): {
1913
+ command: string;
1914
+ args: string[];
1915
+ usedSudo: boolean;
1916
+ };
1917
+ declare function commandExists(command: string): Promise<boolean>;
1774
1918
  /**
1775
- * Retry async function with exponential backoff
1919
+ * Get possible Homebrew paths for a command on macOS
1920
+ * Handles both Apple Silicon (/opt/homebrew) and Intel (/usr/local) installations
1921
+ * Also checks npm global paths within Homebrew's node installation
1922
+ * and Homebrew cask installations in Caskroom
1776
1923
  */
1777
- declare function retry<T>(fn: () => Promise<T>, options?: {
1778
- maxAttempts?: number;
1779
- delay?: number;
1780
- backoff?: number;
1781
- onRetry?: (error: Error, attempt: number) => void;
1782
- }): Promise<T>;
1924
+ declare function getHomebrewCommandPaths(command: string): Promise<string[]>;
1783
1925
  /**
1784
- * Timeout a promise
1926
+ * Find the actual path of a command, checking standard PATH and Homebrew locations
1927
+ * Returns null if command is not found
1785
1928
  */
1786
- declare function timeout<T>(promise: Promise<T>, ms: number, errorMessage?: string): Promise<T>;
1929
+ declare function findCommandPath(command: string): Promise<string | null>;
1787
1930
  /**
1788
- * Debounce async function
1931
+ * Find the real binary path of a command, bypassing shell functions/aliases
1932
+ * This is useful when a shell function wraps a command and we need the actual binary
1933
+ * Returns null if command is not found
1789
1934
  */
1790
- declare function debounce<T extends (...args: any[]) => Promise<any>>(fn: T, delay: number): (...args: Parameters<T>) => Promise<ReturnType<T>>;
1935
+ declare function findRealCommandPath(command: string): Promise<string | null>;
1791
1936
  /**
1792
- * Throttle async function
1937
+ * Get recommended install methods for a code tool based on current platform
1938
+ * Returns methods in priority order (most recommended first)
1793
1939
  */
1794
- declare function throttle<T extends (...args: any[]) => Promise<any>>(fn: T, delay: number): (...args: Parameters<T>) => Promise<ReturnType<T>>;
1940
+ type CodeType = 'claude-code' | 'codex';
1941
+ type InstallMethod = 'npm' | 'homebrew' | 'curl' | 'powershell' | 'cmd' | 'npm-global' | 'native';
1942
+ declare function getRecommendedInstallMethods(codeType: CodeType): InstallMethod[];
1943
+
1944
+ type platform_CodeType = CodeType;
1945
+ type platform_InstallMethod = InstallMethod;
1946
+ type platform_WSLInfo = WSLInfo;
1947
+ declare const platform_commandExists: typeof commandExists;
1948
+ declare const platform_findCommandPath: typeof findCommandPath;
1949
+ declare const platform_findRealCommandPath: typeof findRealCommandPath;
1950
+ declare const platform_getHomebrewCommandPaths: typeof getHomebrewCommandPaths;
1951
+ declare const platform_getMcpCommand: typeof getMcpCommand;
1952
+ declare const platform_getRecommendedInstallMethods: typeof getRecommendedInstallMethods;
1953
+ declare const platform_getSystemRoot: typeof getSystemRoot;
1954
+ declare const platform_getTermuxPrefix: typeof getTermuxPrefix;
1955
+ declare const platform_getWSLDistro: typeof getWSLDistro;
1956
+ declare const platform_getWSLInfo: typeof getWSLInfo;
1957
+ declare const platform_isTermux: typeof isTermux;
1958
+ declare const platform_isWSL: typeof isWSL;
1959
+ declare const platform_normalizeTomlPath: typeof normalizeTomlPath;
1960
+ declare const platform_shouldUseSudoForGlobalInstall: typeof shouldUseSudoForGlobalInstall;
1961
+ declare const platform_wrapCommandWithSudo: typeof wrapCommandWithSudo;
1962
+ declare namespace platform {
1963
+ export { platform_commandExists as commandExists, platform_findCommandPath as findCommandPath, platform_findRealCommandPath as findRealCommandPath, platform_getHomebrewCommandPaths as getHomebrewCommandPaths, platform_getMcpCommand as getMcpCommand, getPlatform$1 as getPlatform, platform_getRecommendedInstallMethods as getRecommendedInstallMethods, platform_getSystemRoot as getSystemRoot, platform_getTermuxPrefix as getTermuxPrefix, platform_getWSLDistro as getWSLDistro, platform_getWSLInfo as getWSLInfo, platform_isTermux as isTermux, platform_isWSL as isWSL, isWindows$1 as isWindows, platform_normalizeTomlPath as normalizeTomlPath, platform_shouldUseSudoForGlobalInstall as shouldUseSudoForGlobalInstall, platform_wrapCommandWithSudo as wrapCommandWithSudo };
1964
+ export type { platform_CodeType as CodeType, platform_InstallMethod as InstallMethod, platform_WSLInfo as WSLInfo };
1965
+ }
1966
+
1795
1967
  /**
1796
- * Execute promises in parallel with concurrency limit
1968
+ * Platform Detection Utilities
1969
+ * Provides utilities for detecting and working with different platforms
1797
1970
  */
1798
- declare function parallelLimit<T>(tasks: (() => Promise<T>)[], limit: number): Promise<T[]>;
1971
+ type Platform = 'darwin' | 'linux' | 'win32' | 'unknown';
1972
+ type Architecture = 'x64' | 'arm64' | 'ia32' | 'unknown';
1799
1973
  /**
1800
- * Execute promises in sequence
1974
+ * Get current platform
1801
1975
  */
1802
- declare function sequence<T>(tasks: (() => Promise<T>)[]): Promise<T[]>;
1976
+ declare function getPlatform(): Platform;
1803
1977
  /**
1804
- * Execute promises with all settled (no rejection)
1978
+ * Get current architecture
1805
1979
  */
1806
- declare function allSettled<T>(promises: Promise<T>[]): Promise<Array<{
1807
- status: 'fulfilled';
1808
- value: T;
1809
- } | {
1810
- status: 'rejected';
1811
- reason: any;
1812
- }>>;
1980
+ declare function getArchitecture(): Architecture;
1813
1981
  /**
1814
- * Race promises with timeout
1982
+ * Check if running on macOS
1815
1983
  */
1816
- declare function raceWithTimeout<T>(promises: Promise<T>[], ms: number): Promise<T>;
1984
+ declare function isMacOS(): boolean;
1817
1985
  /**
1818
- * Memoize async function
1986
+ * Check if running on Linux
1819
1987
  */
1820
- declare function memoize<T extends (...args: any[]) => Promise<any>>(fn: T, options?: {
1821
- keyGenerator?: (...args: Parameters<T>) => string;
1822
- ttl?: number;
1823
- }): T;
1988
+ declare function isLinux(): boolean;
1824
1989
  /**
1825
- * Create a deferred promise
1990
+ * Check if running on Windows
1826
1991
  */
1827
- interface Deferred<T> {
1828
- promise: Promise<T>;
1829
- resolve: (value: T) => void;
1830
- reject: (reason?: any) => void;
1831
- }
1832
- declare function defer<T>(): Deferred<T>;
1992
+ declare function isWindows(): boolean;
1833
1993
  /**
1834
- * Wait for condition to be true
1994
+ * Check if running on Unix-like system (macOS or Linux)
1835
1995
  */
1836
- declare function waitFor(condition: () => boolean | Promise<boolean>, options?: {
1837
- timeout?: number;
1838
- interval?: number;
1839
- timeoutMessage?: string;
1840
- }): Promise<void>;
1996
+ declare function isUnix(): boolean;
1841
1997
  /**
1842
- * Execute function with mutex lock
1998
+ * Get platform-specific information
1843
1999
  */
1844
- declare class Mutex {
1845
- private locked;
1846
- private queue;
1847
- acquire(): Promise<void>;
1848
- release(): void;
1849
- runExclusive<T>(fn: () => Promise<T>): Promise<T>;
2000
+ interface PlatformInfo {
2001
+ platform: Platform;
2002
+ architecture: Architecture;
2003
+ release: string;
2004
+ hostname: string;
2005
+ homedir: string;
2006
+ tmpdir: string;
2007
+ cpus: number;
2008
+ totalMemory: number;
2009
+ freeMemory: number;
1850
2010
  }
1851
2011
  /**
1852
- * Create a semaphore for limiting concurrent operations
2012
+ * Get comprehensive platform information
1853
2013
  */
1854
- declare class Semaphore {
1855
- private permits;
1856
- private queue;
1857
- constructor(permits: number);
1858
- acquire(): Promise<void>;
1859
- release(): void;
1860
- runExclusive<T>(fn: () => Promise<T>): Promise<T>;
1861
- }
2014
+ declare function getPlatformInfo(): PlatformInfo;
2015
+
1862
2016
  /**
1863
- * Batch async operations
2017
+ * Platform Path Utilities
2018
+ * Provides utilities for working with platform-specific paths
1864
2019
  */
1865
- declare function batch<T, R>(items: T[], batchSize: number, processor: (batch: T[]) => Promise<R[]>): Promise<R[]>;
2020
+
1866
2021
  /**
1867
- * Poll for result
2022
+ * Get user's home directory
1868
2023
  */
1869
- declare function poll<T>(fn: () => Promise<T>, options?: {
1870
- interval?: number;
1871
- timeout?: number;
1872
- validate?: (result: T) => boolean;
1873
- }): Promise<T>;
2024
+ declare function getHomeDir(): string;
2025
+ /**
2026
+ * Get user's config directory
2027
+ */
2028
+ declare function getConfigDir(appName?: string): string;
2029
+ /**
2030
+ * Get user's data directory
2031
+ */
2032
+ declare function getDataDir(appName?: string): string;
2033
+ /**
2034
+ * Get user's cache directory
2035
+ */
2036
+ declare function getCacheDir(appName?: string): string;
2037
+ /**
2038
+ * Get user's temporary directory
2039
+ */
2040
+ declare function getTempDir(appName?: string): string;
1874
2041
 
1875
2042
  /**
1876
- * Async Utilities
1877
- * Asynchronous operation helpers
2043
+ * String Utilities
2044
+ * String manipulation and formatting functions
2045
+ */
2046
+ /**
2047
+ * Capitalize first letter of string
2048
+ */
2049
+ declare function capitalize(str: string): string;
2050
+ /**
2051
+ * Convert string to camelCase
1878
2052
  */
1879
-
1880
- type index$1_Deferred<T> = Deferred<T>;
1881
- type index$1_Mutex = Mutex;
1882
- declare const index$1_Mutex: typeof Mutex;
1883
- type index$1_Semaphore = Semaphore;
1884
- declare const index$1_Semaphore: typeof Semaphore;
1885
- declare const index$1_allSettled: typeof allSettled;
1886
- declare const index$1_batch: typeof batch;
1887
- declare const index$1_debounce: typeof debounce;
1888
- declare const index$1_defer: typeof defer;
1889
- declare const index$1_memoize: typeof memoize;
1890
- declare const index$1_parallelLimit: typeof parallelLimit;
1891
- declare const index$1_poll: typeof poll;
1892
- declare const index$1_raceWithTimeout: typeof raceWithTimeout;
1893
- declare const index$1_retry: typeof retry;
1894
- declare const index$1_sequence: typeof sequence;
1895
- declare const index$1_sleep: typeof sleep;
1896
- declare const index$1_throttle: typeof throttle;
1897
- declare const index$1_timeout: typeof timeout;
1898
- declare const index$1_waitFor: typeof waitFor;
1899
- declare namespace index$1 {
1900
- export { index$1_Mutex as Mutex, index$1_Semaphore as Semaphore, index$1_allSettled as allSettled, index$1_batch as batch, index$1_debounce as debounce, index$1_defer as defer, index$1_memoize as memoize, index$1_parallelLimit as parallelLimit, index$1_poll as poll, index$1_raceWithTimeout as raceWithTimeout, index$1_retry as retry, index$1_sequence as sequence, index$1_sleep as sleep, index$1_throttle as throttle, index$1_timeout as timeout, index$1_waitFor as waitFor };
1901
- export type { index$1_Deferred as Deferred };
1902
- }
1903
-
2053
+ declare function camelCase(str: string): string;
1904
2054
  /**
1905
- * Error Utilities
1906
- * Error handling and custom error classes
2055
+ * Convert string to PascalCase
1907
2056
  */
2057
+ declare function pascalCase(str: string): string;
1908
2058
  /**
1909
- * Base custom error class
2059
+ * Convert string to snake_case
1910
2060
  */
1911
- declare class BaseError extends Error {
1912
- readonly code?: string | undefined;
1913
- readonly statusCode?: number | undefined;
1914
- readonly details?: any | undefined;
1915
- constructor(message: string, code?: string | undefined, statusCode?: number | undefined, details?: any | undefined);
1916
- toJSON(): {
1917
- name: string;
1918
- message: string;
1919
- code: string | undefined;
1920
- statusCode: number | undefined;
1921
- details: any;
1922
- stack: string | undefined;
1923
- };
1924
- }
2061
+ declare function snakeCase(str: string): string;
1925
2062
  /**
1926
- * Validation error
2063
+ * Convert string to kebab-case
1927
2064
  */
1928
- declare class ValidationError$1 extends BaseError {
1929
- constructor(message: string, details?: any);
1930
- }
2065
+ declare function kebabCase(str: string): string;
1931
2066
  /**
1932
- * Not found error
2067
+ * Convert string to CONSTANT_CASE
1933
2068
  */
1934
- declare class NotFoundError extends BaseError {
1935
- constructor(message: string, details?: any);
1936
- }
2069
+ declare function constantCase(str: string): string;
1937
2070
  /**
1938
- * Unauthorized error
2071
+ * Truncate string to specified length
1939
2072
  */
1940
- declare class UnauthorizedError extends BaseError {
1941
- constructor(message: string, details?: any);
1942
- }
2073
+ declare function truncate(str: string, length: number, suffix?: string): string;
1943
2074
  /**
1944
- * Forbidden error
2075
+ * Pad string to specified length
1945
2076
  */
1946
- declare class ForbiddenError extends BaseError {
1947
- constructor(message: string, details?: any);
1948
- }
2077
+ declare function pad(str: string, length: number, char?: string, direction?: 'left' | 'right' | 'both'): string;
1949
2078
  /**
1950
- * Conflict error
2079
+ * Remove whitespace from both ends
1951
2080
  */
1952
- declare class ConflictError extends BaseError {
1953
- constructor(message: string, details?: any);
1954
- }
2081
+ declare function trim(str: string): string;
1955
2082
  /**
1956
- * Timeout error
2083
+ * Remove whitespace from start
1957
2084
  */
1958
- declare class TimeoutError extends BaseError {
1959
- constructor(message: string, details?: any);
1960
- }
2085
+ declare function trimStart(str: string): string;
1961
2086
  /**
1962
- * Internal error
2087
+ * Remove whitespace from end
1963
2088
  */
1964
- declare class InternalError extends BaseError {
1965
- constructor(message: string, details?: any);
1966
- }
2089
+ declare function trimEnd(str: string): string;
1967
2090
  /**
1968
- * Configuration error
2091
+ * Split string by delimiter
1969
2092
  */
1970
- declare class ConfigurationError extends BaseError {
1971
- constructor(message: string, details?: any);
1972
- }
2093
+ declare function split(str: string, delimiter: string | RegExp): string[];
1973
2094
  /**
1974
- * Network error
2095
+ * Join array of strings
1975
2096
  */
1976
- declare class NetworkError extends BaseError {
1977
- constructor(message: string, details?: any);
1978
- }
2097
+ declare function join(arr: string[], separator?: string): string;
1979
2098
  /**
1980
- * Check if error is of specific type
2099
+ * Replace all occurrences of search with replacement
1981
2100
  */
1982
- declare function isErrorType<T extends Error>(error: unknown, errorClass: new (...args: any[]) => T): error is T;
2101
+ declare function replaceAll(str: string, search: string | RegExp, replacement: string): string;
1983
2102
  /**
1984
- * Get error message safely
2103
+ * Check if string starts with prefix
1985
2104
  */
1986
- declare function getErrorMessage(error: unknown): string;
2105
+ declare function startsWith(str: string, prefix: string): boolean;
1987
2106
  /**
1988
- * Get error stack safely
2107
+ * Check if string ends with suffix
1989
2108
  */
1990
- declare function getErrorStack(error: unknown): string | undefined;
2109
+ declare function endsWith(str: string, suffix: string): boolean;
1991
2110
  /**
1992
- * Format error for logging
2111
+ * Check if string contains substring
1993
2112
  */
1994
- declare function formatError(error: unknown): {
1995
- message: string;
1996
- name?: string;
1997
- code?: string;
1998
- statusCode?: number;
1999
- stack?: string;
2000
- details?: any;
2001
- };
2113
+ declare function contains(str: string, substring: string): boolean;
2002
2114
  /**
2003
- * Wrap error with additional context
2115
+ * Count occurrences of substring
2004
2116
  */
2005
- declare function wrapError(error: unknown, message: string, code?: string): BaseError;
2117
+ declare function countOccurrences(str: string, substring: string): number;
2006
2118
  /**
2007
- * Try-catch wrapper that returns result or error
2119
+ * Reverse string
2008
2120
  */
2009
- declare function tryCatch<T>(fn: () => T): {
2010
- success: true;
2011
- data: T;
2012
- } | {
2013
- success: false;
2014
- error: Error;
2015
- };
2121
+ declare function reverse(str: string): string;
2016
2122
  /**
2017
- * Async try-catch wrapper
2123
+ * Remove all whitespace
2018
2124
  */
2019
- declare function tryCatchAsync<T>(fn: () => Promise<T>): Promise<{
2020
- success: true;
2021
- data: T;
2022
- } | {
2023
- success: false;
2024
- error: Error;
2025
- }>;
2125
+ declare function removeWhitespace(str: string): string;
2026
2126
  /**
2027
- * Assert condition or throw error
2127
+ * Normalize whitespace (replace multiple spaces with single space)
2028
2128
  */
2029
- declare function assert$1(condition: boolean, message: string, ErrorClass?: new (message: string) => Error): asserts condition;
2129
+ declare function normalizeWhitespace(str: string): string;
2030
2130
  /**
2031
- * Create error handler
2131
+ * Extract words from string
2032
2132
  */
2033
- declare function createErrorHandler(handlers: Record<string, (error: Error) => void>, defaultHandler?: (error: Error) => void): (error: unknown) => void;
2133
+ declare function words(str: string): string[];
2034
2134
  /**
2035
- * Aggregate multiple errors
2135
+ * Count words in string
2036
2136
  */
2037
- declare class AggregateError extends BaseError {
2038
- readonly errors: Error[];
2039
- constructor(errors: Error[], message?: string);
2040
- static fromErrors(errors: Error[]): AggregateError;
2041
- }
2137
+ declare function wordCount(str: string): number;
2042
2138
  /**
2043
- * Retry with error handling
2139
+ * Convert string to title case
2044
2140
  */
2045
- declare function retryWithErrorHandling<T>(fn: () => Promise<T>, options?: {
2046
- maxAttempts?: number;
2047
- delay?: number;
2048
- shouldRetry?: (error: Error) => boolean;
2049
- onError?: (error: Error, attempt: number) => void;
2050
- }): Promise<T>;
2051
-
2141
+ declare function titleCase(str: string): string;
2052
2142
  /**
2053
- * Error Utilities
2054
- * Error handling and custom error classes
2143
+ * Convert string to sentence case
2055
2144
  */
2056
-
2057
- type index_AggregateError = AggregateError;
2058
- declare const index_AggregateError: typeof AggregateError;
2059
- type index_BaseError = BaseError;
2060
- declare const index_BaseError: typeof BaseError;
2061
- type index_ConfigurationError = ConfigurationError;
2062
- declare const index_ConfigurationError: typeof ConfigurationError;
2063
- type index_ConflictError = ConflictError;
2064
- declare const index_ConflictError: typeof ConflictError;
2065
- type index_ForbiddenError = ForbiddenError;
2066
- declare const index_ForbiddenError: typeof ForbiddenError;
2067
- type index_InternalError = InternalError;
2068
- declare const index_InternalError: typeof InternalError;
2069
- type index_NetworkError = NetworkError;
2070
- declare const index_NetworkError: typeof NetworkError;
2071
- type index_NotFoundError = NotFoundError;
2072
- declare const index_NotFoundError: typeof NotFoundError;
2073
- type index_TimeoutError = TimeoutError;
2074
- declare const index_TimeoutError: typeof TimeoutError;
2075
- type index_UnauthorizedError = UnauthorizedError;
2076
- declare const index_UnauthorizedError: typeof UnauthorizedError;
2077
- declare const index_createErrorHandler: typeof createErrorHandler;
2078
- declare const index_formatError: typeof formatError;
2079
- declare const index_getErrorMessage: typeof getErrorMessage;
2080
- declare const index_getErrorStack: typeof getErrorStack;
2081
- declare const index_isErrorType: typeof isErrorType;
2082
- declare const index_retryWithErrorHandling: typeof retryWithErrorHandling;
2083
- declare const index_tryCatch: typeof tryCatch;
2084
- declare const index_tryCatchAsync: typeof tryCatchAsync;
2085
- declare const index_wrapError: typeof wrapError;
2086
- declare namespace index {
2087
- export {
2088
- index_AggregateError as AggregateError,
2089
- index_BaseError as BaseError,
2090
- index_ConfigurationError as ConfigurationError,
2091
- index_ConflictError as ConflictError,
2092
- index_ForbiddenError as ForbiddenError,
2093
- index_InternalError as InternalError,
2094
- index_NetworkError as NetworkError,
2095
- index_NotFoundError as NotFoundError,
2096
- index_TimeoutError as TimeoutError,
2097
- index_UnauthorizedError as UnauthorizedError,
2098
- ValidationError$1 as ValidationError,
2099
- assert$1 as assert,
2100
- index_createErrorHandler as createErrorHandler,
2101
- index_formatError as formatError,
2102
- index_getErrorMessage as getErrorMessage,
2103
- index_getErrorStack as getErrorStack,
2104
- index_isErrorType as isErrorType,
2105
- index_retryWithErrorHandling as retryWithErrorHandling,
2106
- index_tryCatch as tryCatch,
2107
- index_tryCatchAsync as tryCatchAsync,
2108
- index_wrapError as wrapError,
2109
- };
2110
- }
2111
-
2145
+ declare function sentenceCase(str: string): string;
2112
2146
  /**
2113
- * CCJK Logger - MUD Style
2114
- *
2115
- * Structured logging with terminal green aesthetics
2147
+ * Escape HTML special characters
2116
2148
  */
2117
- type LogLevel$1 = 'debug' | 'info' | 'warn' | 'error';
2118
- interface LoggerOptions$1 {
2119
- level?: LogLevel$1;
2120
- silent?: boolean;
2121
- }
2122
- declare class Logger$1 {
2123
- private level;
2124
- private silent;
2125
- private levels;
2126
- constructor(options?: LoggerOptions$1);
2127
- private shouldLog;
2128
- private format;
2129
- /** MUD-style color scheme for log levels */
2130
- private colorize;
2131
- debug(message: string, data?: unknown): void;
2132
- info(message: string, data?: unknown): void;
2133
- warn(message: string, data?: unknown): void;
2134
- error(message: string, data?: unknown): void;
2135
- setLevel(level: LogLevel$1): void;
2136
- setSilent(silent: boolean): void;
2137
- }
2138
- declare const logger$1: Logger$1;
2139
-
2140
- declare namespace logger$2 {
2141
- export { Logger$1 as Logger, logger$1 as logger };
2142
- export type { LogLevel$1 as LogLevel, LoggerOptions$1 as LoggerOptions };
2143
- }
2144
-
2149
+ declare function escapeHTML(str: string): string;
2145
2150
  /**
2146
- * Configuration Manager
2147
- * Provides utilities for loading, saving, and managing configuration files
2151
+ * Unescape HTML special characters
2148
2152
  */
2149
- interface ConfigOptions {
2150
- configDir?: string;
2151
- fileName?: string;
2152
- createIfMissing?: boolean;
2153
- validate?: (config: any) => boolean;
2154
- }
2153
+ declare function unescapeHTML(str: string): string;
2155
2154
  /**
2156
- * Configuration Manager class
2157
- * Handles configuration file operations with validation and error handling
2155
+ * Escape regular expression special characters
2158
2156
  */
2159
- declare class ConfigManager<T = any> {
2160
- private readonly namespace;
2161
- private configPath;
2162
- private options;
2163
- private cache?;
2164
- constructor(namespace: string, options?: ConfigOptions);
2165
- /**
2166
- * Get the default configuration directory
2167
- */
2168
- private getDefaultConfigDir;
2169
- /**
2170
- * Load configuration from file
2171
- */
2172
- load(): Promise<T | null>;
2173
- /**
2174
- * Save configuration to file
2175
- */
2176
- save(config: T): Promise<void>;
2177
- /**
2178
- * Update configuration (merge with existing)
2179
- */
2180
- update(updates: Partial<T>): Promise<T>;
2181
- /**
2182
- * Delete configuration file
2183
- */
2184
- delete(): Promise<void>;
2185
- /**
2186
- * Check if configuration file exists
2187
- */
2188
- exists(): Promise<boolean>;
2189
- /**
2190
- * Get configuration path
2191
- */
2192
- getPath(): string;
2193
- /**
2194
- * Get cached configuration (without file I/O)
2195
- */
2196
- getCached(): T | undefined;
2197
- /**
2198
- * Clear cache
2199
- */
2200
- clearCache(): void;
2201
- }
2157
+ declare function escapeRegExp(str: string): string;
2158
+ /**
2159
+ * Generate random string
2160
+ */
2161
+ declare function randomString(length: number, charset?: string): string;
2202
2162
  /**
2203
- * Create a configuration manager instance
2163
+ * Generate UUID v4
2204
2164
  */
2205
- declare function createConfigManager<T = any>(namespace: string, options?: ConfigOptions): ConfigManager<T>;
2165
+ declare function uuid(): string;
2166
+ /**
2167
+ * Slugify string (URL-friendly)
2168
+ */
2169
+ declare function slugify(str: string): string;
2170
+ /**
2171
+ * Extract numbers from string
2172
+ */
2173
+ declare function extractNumbers(str: string): number[];
2174
+ /**
2175
+ * Format template string with values
2176
+ */
2177
+ declare function template(str: string, values: Record<string, any>): string;
2178
+ /**
2179
+ * Repeat string n times
2180
+ */
2181
+ declare function repeat(str: string, count: number): string;
2182
+ /**
2183
+ * Check if string is empty or only whitespace
2184
+ */
2185
+ declare function isBlank(str: string): boolean;
2186
+ /**
2187
+ * Ensure string ends with suffix
2188
+ */
2189
+ declare function ensureSuffix(str: string, suffix: string): string;
2190
+ /**
2191
+ * Ensure string starts with prefix
2192
+ */
2193
+ declare function ensurePrefix(str: string, prefix: string): string;
2194
+ /**
2195
+ * Remove prefix from string
2196
+ */
2197
+ declare function removePrefix(str: string, prefix: string): string;
2198
+ /**
2199
+ * Remove suffix from string
2200
+ */
2201
+ declare function removeSuffix(str: string, suffix: string): string;
2206
2202
 
2207
2203
  /**
2208
- * Configuration Validator
2209
- * Provides utilities for validating configuration objects
2204
+ * String Utilities
2205
+ * String manipulation and formatting
2210
2206
  */
2211
- interface ValidationRule<T = any> {
2212
- field: keyof T;
2213
- required?: boolean;
2214
- type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
2215
- validator?: (value: any) => boolean;
2216
- message?: string;
2217
- }
2218
- interface ValidationError {
2219
- field: string;
2220
- message: string;
2207
+
2208
+ declare const index_camelCase: typeof camelCase;
2209
+ declare const index_capitalize: typeof capitalize;
2210
+ declare const index_constantCase: typeof constantCase;
2211
+ declare const index_contains: typeof contains;
2212
+ declare const index_countOccurrences: typeof countOccurrences;
2213
+ declare const index_endsWith: typeof endsWith;
2214
+ declare const index_ensurePrefix: typeof ensurePrefix;
2215
+ declare const index_ensureSuffix: typeof ensureSuffix;
2216
+ declare const index_escapeHTML: typeof escapeHTML;
2217
+ declare const index_escapeRegExp: typeof escapeRegExp;
2218
+ declare const index_extractNumbers: typeof extractNumbers;
2219
+ declare const index_isBlank: typeof isBlank;
2220
+ declare const index_join: typeof join;
2221
+ declare const index_kebabCase: typeof kebabCase;
2222
+ declare const index_normalizeWhitespace: typeof normalizeWhitespace;
2223
+ declare const index_pad: typeof pad;
2224
+ declare const index_pascalCase: typeof pascalCase;
2225
+ declare const index_randomString: typeof randomString;
2226
+ declare const index_removePrefix: typeof removePrefix;
2227
+ declare const index_removeSuffix: typeof removeSuffix;
2228
+ declare const index_removeWhitespace: typeof removeWhitespace;
2229
+ declare const index_repeat: typeof repeat;
2230
+ declare const index_replaceAll: typeof replaceAll;
2231
+ declare const index_reverse: typeof reverse;
2232
+ declare const index_sentenceCase: typeof sentenceCase;
2233
+ declare const index_slugify: typeof slugify;
2234
+ declare const index_snakeCase: typeof snakeCase;
2235
+ declare const index_split: typeof split;
2236
+ declare const index_startsWith: typeof startsWith;
2237
+ declare const index_template: typeof template;
2238
+ declare const index_titleCase: typeof titleCase;
2239
+ declare const index_trim: typeof trim;
2240
+ declare const index_trimEnd: typeof trimEnd;
2241
+ declare const index_trimStart: typeof trimStart;
2242
+ declare const index_truncate: typeof truncate;
2243
+ declare const index_unescapeHTML: typeof unescapeHTML;
2244
+ declare const index_uuid: typeof uuid;
2245
+ declare const index_wordCount: typeof wordCount;
2246
+ declare const index_words: typeof words;
2247
+ declare namespace index {
2248
+ export {
2249
+ index_camelCase as camelCase,
2250
+ index_capitalize as capitalize,
2251
+ index_constantCase as constantCase,
2252
+ index_contains as contains,
2253
+ index_countOccurrences as countOccurrences,
2254
+ index_endsWith as endsWith,
2255
+ index_ensurePrefix as ensurePrefix,
2256
+ index_ensureSuffix as ensureSuffix,
2257
+ index_escapeHTML as escapeHTML,
2258
+ index_escapeRegExp as escapeRegExp,
2259
+ index_extractNumbers as extractNumbers,
2260
+ index_isBlank as isBlank,
2261
+ index_join as join,
2262
+ index_kebabCase as kebabCase,
2263
+ index_normalizeWhitespace as normalizeWhitespace,
2264
+ index_pad as pad,
2265
+ index_pascalCase as pascalCase,
2266
+ index_randomString as randomString,
2267
+ index_removePrefix as removePrefix,
2268
+ index_removeSuffix as removeSuffix,
2269
+ index_removeWhitespace as removeWhitespace,
2270
+ index_repeat as repeat,
2271
+ index_replaceAll as replaceAll,
2272
+ index_reverse as reverse,
2273
+ index_sentenceCase as sentenceCase,
2274
+ index_slugify as slugify,
2275
+ index_snakeCase as snakeCase,
2276
+ index_split as split,
2277
+ index_startsWith as startsWith,
2278
+ index_template as template,
2279
+ index_titleCase as titleCase,
2280
+ index_trim as trim,
2281
+ index_trimEnd as trimEnd,
2282
+ index_trimStart as trimStart,
2283
+ index_truncate as truncate,
2284
+ index_unescapeHTML as unescapeHTML,
2285
+ index_uuid as uuid,
2286
+ index_wordCount as wordCount,
2287
+ index_words as words,
2288
+ };
2221
2289
  }
2290
+
2291
+ /**
2292
+ * Unified Input Validation Library
2293
+ * Provides reusable validation functions for common input types
2294
+ */
2295
+ /**
2296
+ * Validation result interface
2297
+ */
2222
2298
  interface ValidationResult {
2223
2299
  valid: boolean;
2224
- errors: ValidationError[];
2300
+ error?: string;
2225
2301
  }
2226
2302
  /**
2227
- * Configuration Validator class
2303
+ * Validate array access safety
2228
2304
  */
2229
- declare class ConfigValidator<T = any> {
2230
- private rules;
2231
- constructor(rules: ValidationRule<T>[]);
2232
- /**
2233
- * Validate a configuration object
2234
- */
2235
- validate(config: Partial<T>): ValidationResult;
2236
- /**
2237
- * Validate and throw on error
2238
- */
2239
- validateOrThrow(config: Partial<T>): void;
2240
- }
2305
+ declare function validateArrayAccess<T>(array: T[] | null | undefined, index: number): ValidationResult;
2241
2306
  /**
2242
- * Create a configuration validator
2307
+ * Safely access array element
2243
2308
  */
2244
- declare function createValidator<T = any>(rules: ValidationRule<T>[]): ConfigValidator<T>;
2309
+ declare function safeArrayAccess<T>(array: T[] | null | undefined, index: number, defaultValue?: T): T | undefined;
2245
2310
  /**
2246
- * Common validation functions
2311
+ * Validate object key access
2247
2312
  */
2248
- declare const validators: {
2249
- /**
2250
- * Validate string is not empty
2251
- */
2252
- notEmpty: (value: string) => boolean;
2253
- /**
2254
- * Validate string matches pattern
2255
- */
2256
- pattern: (regex: RegExp) => (value: string) => boolean;
2257
- /**
2258
- * Validate number is in range
2259
- */
2260
- range: (min: number, max: number) => (value: number) => boolean;
2261
- /**
2262
- * Validate string length
2263
- */
2264
- length: (min: number, max?: number) => (value: string) => boolean;
2265
- /**
2266
- * Validate value is one of allowed values
2267
- */
2268
- oneOf: <T>(allowed: T[]) => (value: T) => boolean;
2269
- /**
2270
- * Validate email format
2271
- */
2272
- email: (value: string) => boolean;
2273
- /**
2274
- * Validate URL format
2275
- */
2276
- url: (value: string) => boolean;
2277
- /**
2278
- * Validate object has required keys
2279
- */
2280
- hasKeys: (keys: string[]) => (value: any) => boolean;
2281
- /**
2282
- * Validate array is not empty
2283
- */
2284
- notEmptyArray: (value: any[]) => boolean;
2285
- };
2286
-
2313
+ declare function validateObjectKeyAccess<T extends Record<string, unknown>>(obj: T | null | undefined, key: string): ValidationResult;
2287
2314
  /**
2288
- * Platform Detection Utilities
2289
- * Provides utilities for detecting and working with different platforms
2315
+ * Safely access object property
2290
2316
  */
2291
- type Platform = 'darwin' | 'linux' | 'win32' | 'unknown';
2292
- type Architecture = 'x64' | 'arm64' | 'ia32' | 'unknown';
2317
+ declare function safeObjectAccess<T extends Record<string, unknown>, K extends keyof T>(obj: T | null | undefined, key: K, defaultValue?: T[K]): T[K] | undefined;
2293
2318
  /**
2294
- * Get current platform
2319
+ * Validate environment variable name
2295
2320
  */
2296
- declare function getPlatform(): Platform;
2321
+ declare function isValidEnvVarName(name: string): ValidationResult;
2297
2322
  /**
2298
- * Get current architecture
2323
+ * Sanitize environment variable value
2299
2324
  */
2300
- declare function getArchitecture(): Architecture;
2325
+ declare function sanitizeEnvValue(value: string): string;
2301
2326
  /**
2302
- * Check if running on macOS
2327
+ * Validate URL format
2303
2328
  */
2304
- declare function isMacOS(): boolean;
2329
+ declare function isValidUrl(url: string): ValidationResult;
2305
2330
  /**
2306
- * Check if running on Linux
2331
+ * Validate file path safety (no directory traversal)
2307
2332
  */
2308
- declare function isLinux(): boolean;
2333
+ declare function isValidFilePath(path: string): ValidationResult;
2309
2334
  /**
2310
- * Check if running on Windows
2335
+ * Validate path entry (filename or directory name)
2311
2336
  */
2312
- declare function isWindows(): boolean;
2337
+ declare function isValidPathEntry(entry: string): ValidationResult;
2313
2338
  /**
2314
- * Check if running on Unix-like system (macOS or Linux)
2339
+ * Validate user input string
2315
2340
  */
2316
- declare function isUnix(): boolean;
2341
+ declare function validateUserInput(input: string, options?: {
2342
+ minLength?: number;
2343
+ maxLength?: number;
2344
+ pattern?: RegExp;
2345
+ allowedChars?: string;
2346
+ }): ValidationResult;
2317
2347
  /**
2318
- * Get platform-specific information
2348
+ * Sanitize user input
2319
2349
  */
2320
- interface PlatformInfo {
2321
- platform: Platform;
2322
- architecture: Architecture;
2323
- release: string;
2324
- hostname: string;
2325
- homedir: string;
2326
- tmpdir: string;
2327
- cpus: number;
2328
- totalMemory: number;
2329
- freeMemory: number;
2330
- }
2350
+ declare function sanitizeUserInput(input: string, maxLength?: number): string;
2331
2351
  /**
2332
- * Get comprehensive platform information
2352
+ * Validate API key format
2333
2353
  */
2334
- declare function getPlatformInfo(): PlatformInfo;
2335
-
2354
+ declare function isValidApiKey(apiKey: string): ValidationResult;
2336
2355
  /**
2337
- * Platform Path Utilities
2338
- * Provides utilities for working with platform-specific paths
2356
+ * Format API key for display (mask sensitive parts)
2339
2357
  */
2340
-
2358
+ declare function formatApiKeyDisplay(apiKey: string | null | undefined): string;
2341
2359
  /**
2342
- * Get user's home directory
2360
+ * Validate configuration object structure
2343
2361
  */
2344
- declare function getHomeDir(): string;
2362
+ declare function validateConfigStructure(config: unknown, schema: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>): ValidationResult;
2345
2363
  /**
2346
- * Get user's config directory
2364
+ * Validate array of items
2347
2365
  */
2348
- declare function getConfigDir(appName?: string): string;
2366
+ declare function validateArray(array: unknown, validator: (item: unknown) => ValidationResult): ValidationResult;
2349
2367
  /**
2350
- * Get user's data directory
2368
+ * Validate enum value
2351
2369
  */
2352
- declare function getDataDir(appName?: string): string;
2370
+ declare function isValidEnumValue<T extends string | number>(value: unknown, allowedValues: T[]): ValidationResult;
2353
2371
  /**
2354
- * Get user's cache directory
2372
+ * Validate port number
2355
2373
  */
2356
- declare function getCacheDir(appName?: string): string;
2374
+ declare function isValidPort(port: unknown): ValidationResult;
2357
2375
  /**
2358
- * Get user's temporary directory
2376
+ * Validate hostname
2359
2377
  */
2360
- declare function getTempDir(appName?: string): string;
2378
+ declare function isValidHostname(hostname: string): ValidationResult;
2379
+
2380
+ type validation_ValidationResult = ValidationResult;
2381
+ declare const validation_formatApiKeyDisplay: typeof formatApiKeyDisplay;
2382
+ declare const validation_isValidApiKey: typeof isValidApiKey;
2383
+ declare const validation_isValidEnumValue: typeof isValidEnumValue;
2384
+ declare const validation_isValidEnvVarName: typeof isValidEnvVarName;
2385
+ declare const validation_isValidFilePath: typeof isValidFilePath;
2386
+ declare const validation_isValidHostname: typeof isValidHostname;
2387
+ declare const validation_isValidPathEntry: typeof isValidPathEntry;
2388
+ declare const validation_isValidPort: typeof isValidPort;
2389
+ declare const validation_isValidUrl: typeof isValidUrl;
2390
+ declare const validation_safeArrayAccess: typeof safeArrayAccess;
2391
+ declare const validation_safeObjectAccess: typeof safeObjectAccess;
2392
+ declare const validation_sanitizeEnvValue: typeof sanitizeEnvValue;
2393
+ declare const validation_sanitizeUserInput: typeof sanitizeUserInput;
2394
+ declare const validation_validateArray: typeof validateArray;
2395
+ declare const validation_validateArrayAccess: typeof validateArrayAccess;
2396
+ declare const validation_validateConfigStructure: typeof validateConfigStructure;
2397
+ declare const validation_validateObjectKeyAccess: typeof validateObjectKeyAccess;
2398
+ declare const validation_validateUserInput: typeof validateUserInput;
2399
+ declare namespace validation {
2400
+ export { validation_formatApiKeyDisplay as formatApiKeyDisplay, validation_isValidApiKey as isValidApiKey, validation_isValidEnumValue as isValidEnumValue, validation_isValidEnvVarName as isValidEnvVarName, validation_isValidFilePath as isValidFilePath, validation_isValidHostname as isValidHostname, validation_isValidPathEntry as isValidPathEntry, validation_isValidPort as isValidPort, validation_isValidUrl as isValidUrl, validation_safeArrayAccess as safeArrayAccess, validation_safeObjectAccess as safeObjectAccess, validation_sanitizeEnvValue as sanitizeEnvValue, validation_sanitizeUserInput as sanitizeUserInput, validation_validateArray as validateArray, validation_validateArrayAccess as validateArrayAccess, validation_validateConfigStructure as validateConfigStructure, validation_validateObjectKeyAccess as validateObjectKeyAccess, validation_validateUserInput as validateUserInput };
2401
+ export type { validation_ValidationResult as ValidationResult };
2402
+ }
2361
2403
 
2362
2404
  /**
2363
2405
  * Validation Utilities
@@ -2404,44 +2446,5 @@ declare function assertDefined<T>(value: T | null | undefined, message?: string)
2404
2446
  */
2405
2447
  declare function assert(condition: boolean, message?: string): asserts condition;
2406
2448
 
2407
- /**
2408
- * Logger Utilities
2409
- * Simple logging utilities
2410
- */
2411
- type LogLevel = 'debug' | 'info' | 'warn' | 'error';
2412
- interface LoggerOptions {
2413
- level?: LogLevel;
2414
- prefix?: string;
2415
- timestamp?: boolean;
2416
- colors?: boolean;
2417
- }
2418
- /**
2419
- * Simple logger class
2420
- */
2421
- declare class Logger {
2422
- private level;
2423
- private prefix;
2424
- private timestamp;
2425
- private colors;
2426
- constructor(options?: LoggerOptions);
2427
- private shouldLog;
2428
- private formatMessage;
2429
- private stringify;
2430
- debug(message: string, ...args: any[]): void;
2431
- info(message: string, ...args: any[]): void;
2432
- warn(message: string, ...args: any[]): void;
2433
- error(message: string, ...args: any[]): void;
2434
- setLevel(level: LogLevel): void;
2435
- getLevel(): LogLevel;
2436
- }
2437
- /**
2438
- * Create a logger instance
2439
- */
2440
- declare function createLogger(options?: LoggerOptions): Logger;
2441
- /**
2442
- * Default logger instance
2443
- */
2444
- declare const logger: Logger;
2445
-
2446
- export { AiderTool, BaseCodeTool, BaseError, ClaudeCodeTool, ClineTool, CodexTool, ConfigManager, ConfigValidator, ConfigurationError, ContinueTool, CursorTool, InternalError, Logger, Mutex, NotFoundError, Semaphore, TimeoutError, ToolFactory, ToolRegistry, UnauthorizedError, ValidationError$1 as ValidationError, index$2 as array, assert, assertDefined, index$1 as async, camelCase, capitalize, chunk, index$6 as command, commandExists, config, copyFile, createConfigManager, createLogger, createTool, createValidator, debounce, deepClone, deepMerge, deleteDir, deleteFile, difference, ensureDir, index as error, executeCommand, executeCommandStream, exists, flatten$1 as flatten, flatten as flattenArray, formatError, index$5 as fs, get, getArchitecture, getCacheDir, getCommandPath, getCommandVersion, getConfigDir, getDataDir, getErrorMessage, getHomeDir, getPlatform, getPlatformInfo, getRegistry, getTempDir, has, intersection, isArray, isBoolean, isDefined, isDirectory, isEmail, isFile, isLinux, isMacOS, isNumber, isObject, isString, isURL, isUnix, isWindows, kebabCase, listDirs, listFiles, logger, logger$2 as loggerUtils, moveFile, index$3 as object, omit, parallelLimit, partition, pascalCase, pick, platform, readFile, readJSON, retry, sequence, set, shuffle, sleep, slugify, snakeCase, index$4 as string, template, throttle, timeout, truncate, tryCatch, tryCatchAsync, unflatten, union, unique, validation, validators, waitFor, wrapError, writeFile, writeJSON };
2449
+ export { AiderTool, BaseCodeTool, BaseError, ClaudeCodeTool, ClineTool, CodexTool, ConfigManager, ConfigValidator, ConfigurationError, ContinueTool, CursorTool, InternalError, Logger, Mutex, NotFoundError, Semaphore, TimeoutError, ToolFactory, ToolRegistry, UnauthorizedError, ValidationError, index$6 as array, assert, assertDefined, index$5 as async, camelCase, capitalize, chunk, index$4 as command, commandExists$1 as commandExists, config, copyFile, createConfigManager, createLogger, createTool, createValidator, debounce, deepClone, deepMerge, deleteDir, deleteFile, difference, ensureDir, index$3 as error, executeCommand, executeCommandStream, exists, flatten, flatten$1 as flattenArray, formatError, index$2 as fs, get, getArchitecture, getCacheDir, getCommandPath, getCommandVersion, getConfigDir, getDataDir, getErrorMessage, getHomeDir, getPlatform, getPlatformInfo, getRegistry, getTempDir, has, intersection, isArray, isBoolean, isDefined, isDirectory, isEmail, isFile, isLinux, isMacOS, isNumber, isObject, isString, isURL, isUnix, isWindows, kebabCase, listDirs, listFiles, logger, logger$2 as loggerUtils, moveFile, index$1 as object, omit, parallelLimit, partition, pascalCase, pick, platform, readFile, readJSON, retry, sequence, set, shuffle, sleep, slugify, snakeCase, index as string, template, throttle, timeout, truncate, tryCatch, tryCatchAsync, unflatten, union, unique, validation, validators, waitFor, wrapError, writeFile, writeJSON };
2447
2450
  export type { ExecutionResult, IChatTool, ICodeGenTool, ICodeTool, IFileEditTool, InstallStatus, ToolCapabilities, ToolConfig, ToolMetadata };