ccjk 12.0.6 → 12.0.7

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.
Files changed (62) hide show
  1. package/README.md +14 -0
  2. package/README.zh-CN.md +13 -0
  3. package/dist/chunks/api-cli.mjs +1 -1
  4. package/dist/chunks/ccjk-agents.mjs +3 -2
  5. package/dist/chunks/ccjk-all.mjs +129 -1764
  6. package/dist/chunks/ccjk-hooks.mjs +5 -4
  7. package/dist/chunks/ccjk-mcp.mjs +7 -6
  8. package/dist/chunks/ccjk-setup.mjs +3 -2
  9. package/dist/chunks/ccjk-skills.mjs +6 -5
  10. package/dist/chunks/ccr.mjs +6 -5
  11. package/dist/chunks/check-updates.mjs +8 -8
  12. package/dist/chunks/claude-code-config-manager.mjs +1 -1
  13. package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
  14. package/dist/chunks/codex-config-switch.mjs +1 -1
  15. package/dist/chunks/codex-provider-manager.mjs +1 -1
  16. package/dist/chunks/config-switch.mjs +1 -1
  17. package/dist/chunks/config.mjs +1 -1
  18. package/dist/chunks/config2.mjs +1 -1
  19. package/dist/chunks/config3.mjs +1 -1
  20. package/dist/chunks/constants.mjs +33 -2
  21. package/dist/chunks/dashboard.mjs +115 -3
  22. package/dist/chunks/features.mjs +3 -3
  23. package/dist/chunks/init.mjs +108 -4
  24. package/dist/chunks/installer2.mjs +7 -7
  25. package/dist/chunks/manager.mjs +1048 -0
  26. package/dist/chunks/mcp-cli.mjs +1 -1
  27. package/dist/chunks/mcp.mjs +1 -1
  28. package/dist/chunks/menu.mjs +22 -1
  29. package/dist/chunks/notification.mjs +5 -2
  30. package/dist/chunks/package.mjs +1 -1
  31. package/dist/chunks/quick-provider.mjs +1 -269
  32. package/dist/chunks/quick-setup.mjs +10 -10
  33. package/dist/chunks/remote.mjs +4 -1
  34. package/dist/chunks/simple-config.mjs +1 -1
  35. package/dist/chunks/skill.mjs +117 -9003
  36. package/dist/chunks/skill2.mjs +9003 -0
  37. package/dist/chunks/skills-sync.mjs +536 -55
  38. package/dist/chunks/skills.mjs +7 -1156
  39. package/dist/chunks/smart-defaults.mjs +87 -9
  40. package/dist/chunks/status.mjs +1 -1
  41. package/dist/chunks/uninstall.mjs +1 -1
  42. package/dist/chunks/update.mjs +2 -2
  43. package/dist/chunks/zero-config.mjs +6 -2
  44. package/dist/cli.mjs +3 -1
  45. package/dist/i18n/locales/en/cloud.json +40 -0
  46. package/dist/i18n/locales/zh-CN/cloud.json +40 -0
  47. package/dist/index.d.mts +2586 -2
  48. package/dist/index.d.ts +2586 -2
  49. package/dist/index.mjs +1340 -7
  50. package/dist/shared/ccjk.B364Fu0N.mjs +1819 -0
  51. package/dist/shared/ccjk.BtB1e5jm.mjs +171 -0
  52. package/dist/shared/{ccjk.BnpWvs9V.mjs → ccjk.BwfbSKN2.mjs} +1 -1
  53. package/dist/shared/{ccjk.AqnXPAzw.mjs → ccjk.C2jHOZVP.mjs} +1 -1
  54. package/dist/shared/{ccjk.BSYWk9ML.mjs → ccjk.Cjj8SVrn.mjs} +1 -1
  55. package/dist/shared/ccjk.D6ycHbak.mjs +270 -0
  56. package/dist/shared/ccjk.D8ZLYSZZ.mjs +299 -0
  57. package/dist/shared/{ccjk.s7OCVzdd.mjs → ccjk.DS7UESmF.mjs} +2 -1483
  58. package/dist/shared/{ccjk.BiCrMV5O.mjs → ccjk.DXRAZcix.mjs} +0 -28
  59. package/dist/shared/ccjk.UIvifqNE.mjs +1486 -0
  60. package/dist/shared/{ccjk.BDKUdmLk.mjs → ccjk.c-ETfBZ_.mjs} +208 -86
  61. package/package.json +5 -1
  62. package/templates/claude-code/common/settings.json +3 -1
package/dist/index.d.ts CHANGED
@@ -2707,5 +2707,2589 @@ declare function assertDefined<T>(value: T | null | undefined, message?: string)
2707
2707
  */
2708
2708
  declare function assert(condition: boolean, message?: string): asserts condition;
2709
2709
 
2710
- 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, batchProcessFiles, camelCase, capitalize, chunk, index$4 as command, commandExists$1 as commandExists, config, copyFile, countLines, createConfigManager, createLogger, createTool, createValidator, debounce, deepClone, deepMerge, deleteDir, deleteFile, difference, ensureDir, index$3 as error, executeCommand, executeCommandStream, exists, extractDisplayName, extractString, flatten, flatten$1 as flattenArray, formatError, index$2 as fs, generateCompactWelcome, generateRecommendations, generateWelcome, get, getArchitecture, getCacheDir, getCapabilitiesByType, getCapability, getCommandPath, getCommandVersion, getConfigDir, getDataDir, getErrorMessage, getFileInfo, getFileSize, getHomeDir, getPlatform, getPlatformInfo, getRegistry, getTempDir, has, i18nHelpers, intersection, isArray, isBoolean, isDefined, isDirectory, isEmail, isFile, isLargeFile, isLinux, isMacOS, isNumber, isObject, isString, isURL, isUnix, isWindows, kebabCase, listDirs, listFiles, logger, logger$2 as loggerUtils, moveFile, normalizeRecommendation, normalizeRecommendations, index$1 as object, omit, parallelLimit, partition, pascalCase, pick, platform, processLargeFile, processLineByLine, readFile, readJSON, retry, scanCapabilities, sequence, set, shuffle, sleep, slugify, snakeCase, streamJSON, streamWriteJSON, index as string, template, throttle, timeout, truncate, tryCatch, tryCatchAsync, unflatten, union, unique, validation, validators, waitFor, wrapError, writeFile, writeJSON };
2711
- export type { Capability, CapabilityScanResult, CapabilityStatus, CapabilityType, ChunkProcessorOptions, ExecutionResult, FileInfo, IChatTool, ICodeGenTool, ICodeTool, IFileEditTool, InstallStatus, MultilingualString, StreamProcessorOptions, ToolCapabilities, ToolConfig, ToolMetadata, WelcomeOptions };
2710
+ /**
2711
+ * Cloud Client DTO (Data Transfer Objects)
2712
+ *
2713
+ * Strict type definitions and converters for API responses
2714
+ * Eliminates `any` types in core cloud flows
2715
+ *
2716
+ * @module cloud-client/dto
2717
+ */
2718
+
2719
+ /**
2720
+ * MCP Server Configuration
2721
+ */
2722
+ interface McpServerConfig {
2723
+ type?: 'stdio' | 'http' | 'websocket';
2724
+ command?: string;
2725
+ args?: string[];
2726
+ env?: Record<string, string>;
2727
+ npmPackage?: string;
2728
+ installCommand?: string;
2729
+ }
2730
+ /**
2731
+ * Skill Configuration
2732
+ */
2733
+ interface SkillConfig {
2734
+ enabled?: boolean;
2735
+ priority?: number;
2736
+ triggers?: string[];
2737
+ parameters?: Record<string, string | number | boolean>;
2738
+ }
2739
+ /**
2740
+ * Agent Configuration
2741
+ */
2742
+ interface AgentConfig {
2743
+ persona?: string;
2744
+ capabilities?: string[];
2745
+ skills?: string[];
2746
+ mcpServers?: string[];
2747
+ temperature?: number;
2748
+ maxTokens?: number;
2749
+ }
2750
+ /**
2751
+ * Hook Configuration
2752
+ */
2753
+ interface HookConfig {
2754
+ command?: string;
2755
+ args?: string[];
2756
+ when?: 'pre' | 'post';
2757
+ enabled?: boolean;
2758
+ }
2759
+ /**
2760
+ * Workflow Configuration
2761
+ */
2762
+ interface WorkflowConfig {
2763
+ steps?: string[];
2764
+ triggers?: string[];
2765
+ conditions?: Record<string, string | boolean>;
2766
+ }
2767
+ /**
2768
+ * Union type for all config types
2769
+ */
2770
+ type RecommendationConfig = McpServerConfig | SkillConfig | AgentConfig | HookConfig | WorkflowConfig;
2771
+ /**
2772
+ * Allowed template parameter default values
2773
+ */
2774
+ type TemplateParameterValue = string | number | boolean | string[] | number[] | Record<string, string | number | boolean> | null;
2775
+ /**
2776
+ * Template download telemetry data
2777
+ */
2778
+ interface TemplateDownloadData {
2779
+ templateId: string;
2780
+ templateType: string;
2781
+ timestamp: number;
2782
+ }
2783
+ /**
2784
+ * Recommendation shown telemetry data
2785
+ */
2786
+ interface RecommendationShownData {
2787
+ recommendationId: string;
2788
+ category: string;
2789
+ timestamp: number;
2790
+ }
2791
+ /**
2792
+ * Recommendation accepted telemetry data
2793
+ */
2794
+ interface RecommendationAcceptedData {
2795
+ recommendationId: string;
2796
+ category: string;
2797
+ timestamp: number;
2798
+ }
2799
+ /**
2800
+ * Analysis completed telemetry data
2801
+ */
2802
+ interface AnalysisCompletedData {
2803
+ projectType?: string;
2804
+ frameworks?: string[];
2805
+ recommendationCount: number;
2806
+ timestamp: number;
2807
+ }
2808
+ /**
2809
+ * Error occurred telemetry data
2810
+ */
2811
+ interface ErrorOccurredData {
2812
+ errorType: string;
2813
+ errorMessage?: string;
2814
+ context?: string;
2815
+ timestamp: number;
2816
+ }
2817
+ /**
2818
+ * Batch telemetry data
2819
+ */
2820
+ interface BatchTelemetryData {
2821
+ events: Array<{
2822
+ type: MetricType;
2823
+ data?: TelemetryEventData;
2824
+ timestamp: string;
2825
+ }>;
2826
+ batchSize: number;
2827
+ userId: string;
2828
+ }
2829
+ /**
2830
+ * Union type for all telemetry data
2831
+ */
2832
+ type TelemetryEventData = TemplateDownloadData | RecommendationShownData | RecommendationAcceptedData | AnalysisCompletedData | ErrorOccurredData | BatchTelemetryData;
2833
+ /**
2834
+ * Raw recommendation from cloud API
2835
+ */
2836
+ interface RawRecommendation {
2837
+ id: string;
2838
+ name: string | Record<string, string>;
2839
+ description: string | Record<string, string>;
2840
+ category: 'skill' | 'mcp' | 'agent' | 'hook';
2841
+ relevanceScore: number;
2842
+ installCommand?: string;
2843
+ config?: unknown;
2844
+ tags?: string[];
2845
+ dependencies?: string[];
2846
+ }
2847
+ /**
2848
+ * Raw template from cloud API
2849
+ */
2850
+ interface RawTemplate {
2851
+ id: string;
2852
+ type: 'workflow' | 'output-style' | 'prompt' | 'agent';
2853
+ name: string | Record<string, string>;
2854
+ description: string | Record<string, string>;
2855
+ content: string;
2856
+ version: string;
2857
+ author?: string;
2858
+ tags?: string[];
2859
+ parameters?: Array<{
2860
+ name: string;
2861
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
2862
+ required: boolean;
2863
+ default?: unknown;
2864
+ description?: string | Record<string, string>;
2865
+ }>;
2866
+ createdAt: string;
2867
+ updatedAt: string;
2868
+ }
2869
+ /**
2870
+ * Raw project analysis response from cloud API
2871
+ */
2872
+ interface RawProjectAnalysisResponse {
2873
+ requestId: string;
2874
+ recommendations: RawRecommendation[];
2875
+ projectType?: string;
2876
+ frameworks?: string[];
2877
+ }
2878
+ /**
2879
+ * Raw batch template response from cloud API
2880
+ */
2881
+ interface RawBatchTemplateResponse {
2882
+ requestId: string;
2883
+ templates: Record<string, RawTemplate>;
2884
+ notFound: string[];
2885
+ }
2886
+ /**
2887
+ * Validate and convert config object
2888
+ */
2889
+ declare function convertConfig(config: unknown): RecommendationConfig | undefined;
2890
+ /**
2891
+ * Convert template parameter default value
2892
+ */
2893
+ declare function convertParameterDefault(value: unknown): TemplateParameterValue;
2894
+ /**
2895
+ * Convert raw recommendation to typed recommendation
2896
+ */
2897
+ declare function convertRecommendation(raw: RawRecommendation, preferredLang?: 'en' | 'zh-CN'): Recommendation;
2898
+ /**
2899
+ * Convert raw template parameter to typed parameter
2900
+ */
2901
+ declare function convertTemplateParameter(raw: {
2902
+ name: string;
2903
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
2904
+ required: boolean;
2905
+ default?: unknown;
2906
+ description?: string | Record<string, string>;
2907
+ }): TemplateParameter;
2908
+ /**
2909
+ * Convert raw template to typed template
2910
+ */
2911
+ declare function convertTemplate(raw: RawTemplate, preferredLang?: 'en' | 'zh-CN'): TemplateResponse;
2912
+ /**
2913
+ * Convert raw project analysis response to typed response
2914
+ */
2915
+ declare function convertProjectAnalysisResponse(raw: RawProjectAnalysisResponse, preferredLang?: 'en' | 'zh-CN'): ProjectAnalysisResponse;
2916
+ /**
2917
+ * Convert raw batch template response to typed response
2918
+ */
2919
+ declare function convertBatchTemplateResponse(raw: RawBatchTemplateResponse, preferredLang?: 'en' | 'zh-CN'): BatchTemplateResponse$1;
2920
+ /**
2921
+ * Validate project analysis request
2922
+ */
2923
+ declare function validateProjectAnalysisRequest(request: ProjectAnalysisRequest): {
2924
+ valid: boolean;
2925
+ errors: string[];
2926
+ };
2927
+ /**
2928
+ * Validate batch template request
2929
+ */
2930
+ declare function validateBatchTemplateRequest(request: BatchTemplateRequest): {
2931
+ valid: boolean;
2932
+ errors: string[];
2933
+ };
2934
+ /**
2935
+ * Validate usage report
2936
+ */
2937
+ declare function validateUsageReport(report: UsageReport): {
2938
+ valid: boolean;
2939
+ errors: string[];
2940
+ };
2941
+ /**
2942
+ * Check if value is a valid recommendation config
2943
+ */
2944
+ declare function isRecommendationConfig(value: unknown): value is RecommendationConfig;
2945
+ /**
2946
+ * Check if value is a valid telemetry event data
2947
+ */
2948
+ declare function isTelemetryEventData(value: unknown): value is TelemetryEventData;
2949
+ /**
2950
+ * Check if value is a valid template parameter value
2951
+ */
2952
+ declare function isTemplateParameterValue(value: unknown): value is TemplateParameterValue;
2953
+
2954
+ /**
2955
+ * Cloud Client API Types
2956
+ *
2957
+ * Type definitions for the CCJK Cloud API v1.0.0
2958
+ * @module cloud-client/types
2959
+ */
2960
+ /**
2961
+ * Project analysis request payload
2962
+ */
2963
+ interface ProjectAnalysisRequest {
2964
+ /** Project root directory path */
2965
+ projectRoot: string;
2966
+ /** Package.json dependencies */
2967
+ dependencies?: Record<string, string>;
2968
+ /** Dev dependencies */
2969
+ devDependencies?: Record<string, string>;
2970
+ /** Git repository URL */
2971
+ gitRemote?: string;
2972
+ /** Project language (zh-CN, en, ja, ko) */
2973
+ language?: string;
2974
+ /** CCJK version */
2975
+ ccjkVersion?: string;
2976
+ }
2977
+ /**
2978
+ * Recommended tool or workflow
2979
+ */
2980
+ interface Recommendation {
2981
+ /** Unique identifier */
2982
+ id: string;
2983
+ /** Display name (multilingual) */
2984
+ name: Record<string, string>;
2985
+ /** Description (multilingual) */
2986
+ description: Record<string, string>;
2987
+ /** Category: skill, mcp, agent, hook */
2988
+ category: 'skill' | 'mcp' | 'agent' | 'hook';
2989
+ /** Relevance score (0-1) */
2990
+ relevanceScore: number;
2991
+ /** Install command */
2992
+ installCommand?: string;
2993
+ /** Configuration JSON - use RecommendationConfig from dto.ts for strict typing */
2994
+ config?: RecommendationConfig;
2995
+ /** Tags for filtering */
2996
+ tags?: string[];
2997
+ /** Dependencies required */
2998
+ dependencies?: string[];
2999
+ }
3000
+ /**
3001
+ * Project analysis response
3002
+ */
3003
+ interface ProjectAnalysisResponse {
3004
+ /** Unique request ID for tracking */
3005
+ requestId: string;
3006
+ /** Array of personalized recommendations */
3007
+ recommendations: Recommendation[];
3008
+ /** Project type detection result */
3009
+ projectType?: string;
3010
+ /** Framework detection results */
3011
+ frameworks?: string[];
3012
+ }
3013
+ /**
3014
+ * Template type
3015
+ */
3016
+ type TemplateType$1 = 'workflow' | 'output-style' | 'prompt' | 'agent';
3017
+ /**
3018
+ * Template response
3019
+ */
3020
+ interface TemplateResponse {
3021
+ /** Unique template identifier */
3022
+ id: string;
3023
+ /** Template type */
3024
+ type: TemplateType$1;
3025
+ /** Template name (multilingual) */
3026
+ name: Record<string, string>;
3027
+ /** Template description (multilingual) */
3028
+ description: Record<string, string>;
3029
+ /** Template content */
3030
+ content: string;
3031
+ /** Version */
3032
+ version: string;
3033
+ /** Author */
3034
+ author?: string;
3035
+ /** Tags */
3036
+ tags?: string[];
3037
+ /** Required parameters */
3038
+ parameters?: TemplateParameter[];
3039
+ /** ISO 8601 creation timestamp */
3040
+ createdAt: string;
3041
+ /** ISO 8601 update timestamp */
3042
+ updatedAt: string;
3043
+ }
3044
+ /**
3045
+ * Template parameter definition
3046
+ */
3047
+ interface TemplateParameter {
3048
+ /** Parameter name */
3049
+ name: string;
3050
+ /** Parameter type */
3051
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
3052
+ /** Required flag */
3053
+ required: boolean;
3054
+ /** Default value - use TemplateParameterValue from dto.ts for strict typing */
3055
+ default?: TemplateParameterValue;
3056
+ /** Description (multilingual) */
3057
+ description?: Record<string, string>;
3058
+ }
3059
+ /**
3060
+ * Batch template request
3061
+ */
3062
+ interface BatchTemplateRequest {
3063
+ /** Template IDs to fetch */
3064
+ ids: string[];
3065
+ /** Language for translations */
3066
+ language?: string;
3067
+ }
3068
+ /**
3069
+ * Batch template response
3070
+ */
3071
+ interface BatchTemplateResponse$1 {
3072
+ /** Request ID for tracking */
3073
+ requestId: string;
3074
+ /** Map of template ID to template content */
3075
+ templates: Record<string, TemplateResponse>;
3076
+ /** IDs that were not found */
3077
+ notFound: string[];
3078
+ }
3079
+ /**
3080
+ * Usage metric type
3081
+ */
3082
+ type MetricType = 'template_download' | 'recommendation_shown' | 'recommendation_accepted' | 'analysis_completed' | 'error_occurred';
3083
+ /**
3084
+ * Usage report payload
3085
+ */
3086
+ interface UsageReport {
3087
+ /** Unique report ID */
3088
+ reportId: string;
3089
+ /** Metric type */
3090
+ metricType: MetricType;
3091
+ /** ISO 8601 timestamp */
3092
+ timestamp: string;
3093
+ /** CCJK version */
3094
+ ccjkVersion: string;
3095
+ /** Node.js version */
3096
+ nodeVersion: string;
3097
+ /** Operating system */
3098
+ platform: string;
3099
+ /** Project language if applicable */
3100
+ language?: string;
3101
+ /** Additional context data - use TelemetryEventData from dto.ts for strict typing */
3102
+ data?: TelemetryEventData;
3103
+ }
3104
+ /**
3105
+ * Usage report response
3106
+ */
3107
+ interface UsageReportResponse {
3108
+ /** Success indicator */
3109
+ success: boolean;
3110
+ /** Request ID */
3111
+ requestId: string;
3112
+ /** Message from server */
3113
+ message?: string;
3114
+ }
3115
+ /**
3116
+ * Health check response
3117
+ */
3118
+ interface HealthCheckResponse {
3119
+ /** Service health status */
3120
+ status: 'healthy' | 'degraded' | 'unhealthy';
3121
+ /** API version */
3122
+ version: string;
3123
+ /** Current timestamp */
3124
+ timestamp: string;
3125
+ /** Optional service messages */
3126
+ message?: string;
3127
+ }
3128
+ /**
3129
+ * Cloud client error types
3130
+ * @deprecated Use CloudErrorCode from './errors' instead
3131
+ */
3132
+ type CloudClientErrorType = 'NETWORK_ERROR' | 'TIMEOUT_ERROR' | 'API_ERROR' | 'VALIDATION_ERROR' | 'AUTH_ERROR' | 'RATE_LIMIT_ERROR' | 'SERVER_ERROR' | 'UNKNOWN_ERROR';
3133
+ /**
3134
+ * Cloud client error class
3135
+ * @deprecated Use CloudError from './errors' instead
3136
+ */
3137
+ declare class CloudClientError extends Error {
3138
+ /** Error type */
3139
+ readonly type: CloudClientErrorType;
3140
+ /** HTTP status code if applicable */
3141
+ readonly statusCode?: number;
3142
+ /** Original error */
3143
+ readonly originalError?: unknown;
3144
+ constructor(type: CloudClientErrorType, message: string, statusCode?: number, originalError?: unknown);
3145
+ /**
3146
+ * Create error from HTTP response
3147
+ */
3148
+ static fromResponse(statusCode: number, message: string): CloudClientError;
3149
+ /**
3150
+ * Create network error
3151
+ */
3152
+ static network(error: unknown): CloudClientError;
3153
+ /**
3154
+ * Create timeout error
3155
+ */
3156
+ static timeout(timeout: number): CloudClientError;
3157
+ /**
3158
+ * Create validation error
3159
+ */
3160
+ static validation(message: string): CloudClientError;
3161
+ }
3162
+ /**
3163
+ * Cloud client configuration
3164
+ */
3165
+ interface CloudClientConfig {
3166
+ /** API base URL */
3167
+ baseURL: string;
3168
+ /** Request timeout in milliseconds */
3169
+ timeout?: number;
3170
+ /** CCJK version header */
3171
+ version?: string;
3172
+ /** Enable caching */
3173
+ enableCache?: boolean;
3174
+ /** Cache directory path */
3175
+ cacheDir?: string;
3176
+ /** Enable retry logic */
3177
+ enableRetry?: boolean;
3178
+ /** Maximum retry attempts */
3179
+ maxRetries?: number;
3180
+ /** Enable telemetry reporting */
3181
+ enableTelemetry?: boolean;
3182
+ /** API key if required */
3183
+ apiKey?: string;
3184
+ /** Language for API responses */
3185
+ language?: string;
3186
+ }
3187
+ /**
3188
+ * Cache entry metadata
3189
+ */
3190
+ interface CacheEntry<T> {
3191
+ /** Cached data */
3192
+ data: T;
3193
+ /** Expiration timestamp */
3194
+ expiresAt: number;
3195
+ /** Cache key */
3196
+ key: string;
3197
+ }
3198
+ /**
3199
+ * Retry configuration
3200
+ */
3201
+ interface RetryConfig {
3202
+ /** Maximum retry attempts */
3203
+ maxAttempts: number;
3204
+ /** Initial delay in milliseconds */
3205
+ initialDelay: number;
3206
+ /** Backoff multiplier */
3207
+ multiplier: number;
3208
+ /** Maximum delay in milliseconds */
3209
+ maxDelay: number;
3210
+ /** HTTP status codes to retry */
3211
+ retryableStatusCodes: number[];
3212
+ }
3213
+ /**
3214
+ * Telemetry configuration
3215
+ */
3216
+ interface TelemetryConfig {
3217
+ /** Enable telemetry reporting */
3218
+ enabled: boolean;
3219
+ /** Batch size before sending */
3220
+ batchSize: number;
3221
+ /** Maximum time to wait before sending (ms) */
3222
+ flushInterval: number;
3223
+ /** Anonymous user ID */
3224
+ userId?: string;
3225
+ }
3226
+
3227
+ /**
3228
+ * Cloud Client Implementation
3229
+ *
3230
+ * Main HTTP client for CCJK Cloud API
3231
+ * @module cloud-client/client
3232
+ */
3233
+
3234
+ /**
3235
+ * Cloud Client Class
3236
+ *
3237
+ * Provides methods to interact with the CCJK Cloud API
3238
+ */
3239
+ declare class CloudClient {
3240
+ private fetch;
3241
+ private config;
3242
+ constructor(config: CloudClientConfig);
3243
+ /**
3244
+ * Calculate retry delay with exponential backoff
3245
+ */
3246
+ private calculateRetryDelay;
3247
+ /**
3248
+ * Handle fetch errors and convert to CloudClientError
3249
+ */
3250
+ private handleError;
3251
+ /**
3252
+ * Analyze project and get recommendations
3253
+ *
3254
+ * POST /api/v1/analysis/projects
3255
+ *
3256
+ * @param request - Project analysis request
3257
+ * @returns Project analysis response with recommendations
3258
+ */
3259
+ analyzeProject(request: ProjectAnalysisRequest): Promise<ProjectAnalysisResponse>;
3260
+ /**
3261
+ * Get a single template by ID
3262
+ *
3263
+ * GET /api/v1/templates/:id
3264
+ *
3265
+ * @param id - Template identifier
3266
+ * @param language - Language for translations (optional)
3267
+ * @returns Template response
3268
+ */
3269
+ getTemplate(id: string, language?: string): Promise<TemplateResponse>;
3270
+ /**
3271
+ * Get multiple templates in batch
3272
+ *
3273
+ * POST /api/v1/templates/batch
3274
+ *
3275
+ * @param request - Batch template request
3276
+ * @returns Batch template response
3277
+ */
3278
+ getBatchTemplates(request: BatchTemplateRequest): Promise<BatchTemplateResponse$1>;
3279
+ /**
3280
+ * Report usage metrics (non-blocking with short timeout)
3281
+ *
3282
+ * POST /api/v1/telemetry/installation
3283
+ *
3284
+ * @param report - Usage report payload
3285
+ * @returns Usage report response
3286
+ */
3287
+ reportUsage(report: UsageReport): Promise<UsageReportResponse>;
3288
+ /**
3289
+ * Check API health status
3290
+ *
3291
+ * GET /api/v1/health
3292
+ *
3293
+ * @returns Health check response
3294
+ */
3295
+ healthCheck(): Promise<HealthCheckResponse>;
3296
+ /**
3297
+ * Update client configuration
3298
+ *
3299
+ * @param config - Partial configuration to update
3300
+ */
3301
+ updateConfig(config: Partial<CloudClientConfig>): void;
3302
+ /**
3303
+ * Get current configuration
3304
+ */
3305
+ getConfig(): CloudClientConfig;
3306
+ }
3307
+ /**
3308
+ * Create a default cloud client instance
3309
+ */
3310
+ declare function createCloudClient(config?: Partial<CloudClientConfig>): CloudClient;
3311
+
3312
+ /**
3313
+ * Simple in-memory cache with filesystem persistence
3314
+ */
3315
+ declare class CloudCache {
3316
+ private memoryCache;
3317
+ private cacheDir;
3318
+ private enabled;
3319
+ constructor(config: CloudClientConfig);
3320
+ /**
3321
+ * Ensure cache directory exists
3322
+ */
3323
+ private ensureCacheDir;
3324
+ /**
3325
+ * Load cache from disk
3326
+ */
3327
+ private loadCacheFromDisk;
3328
+ /**
3329
+ * Save cache to disk
3330
+ */
3331
+ private saveCacheToDisk;
3332
+ /**
3333
+ * Generate cache key from parameters
3334
+ */
3335
+ generateKey(prefix: string, params: Record<string, unknown> | object): string;
3336
+ /**
3337
+ * Get cached value
3338
+ *
3339
+ * @param key - Cache key
3340
+ * @returns Cached value or undefined if not found/expired
3341
+ */
3342
+ get<T>(key: string): T | undefined;
3343
+ /**
3344
+ * Set cached value with TTL
3345
+ *
3346
+ * @param key - Cache key
3347
+ * @param value - Value to cache
3348
+ * @param ttlSeconds - Time to live in seconds
3349
+ */
3350
+ set<T>(key: string, value: T, ttlSeconds: number): void;
3351
+ /**
3352
+ * Delete cache entry
3353
+ *
3354
+ * @param key - Cache key
3355
+ */
3356
+ delete(key: string): void;
3357
+ /**
3358
+ * Clear all cache entries
3359
+ */
3360
+ clear(): void;
3361
+ /**
3362
+ * Clean expired entries
3363
+ */
3364
+ cleanExpired(): void;
3365
+ /**
3366
+ * Get cache statistics
3367
+ */
3368
+ getStats(): {
3369
+ size: number;
3370
+ keys: string[];
3371
+ };
3372
+ }
3373
+ /**
3374
+ * Cached Cloud Client
3375
+ *
3376
+ * Wraps CloudClient with caching layer
3377
+ */
3378
+ declare class CachedCloudClient {
3379
+ private client;
3380
+ private cache;
3381
+ constructor(client: CloudClient, cache: CloudCache);
3382
+ /**
3383
+ * Analyze project with caching (7-day TTL)
3384
+ */
3385
+ analyzeProject(request: ProjectAnalysisRequest): Promise<ProjectAnalysisResponse>;
3386
+ /**
3387
+ * Get template with caching (30-day TTL)
3388
+ */
3389
+ getTemplate(id: string, language?: string): Promise<TemplateResponse>;
3390
+ /**
3391
+ * Get batch templates with caching (30-day TTL)
3392
+ */
3393
+ getBatchTemplates(request: BatchTemplateRequest): Promise<BatchTemplateResponse$1>;
3394
+ /**
3395
+ * Report usage (no caching)
3396
+ */
3397
+ reportUsage(report: UsageReport): Promise<UsageReportResponse>;
3398
+ /**
3399
+ * Health check with caching (5-minute TTL)
3400
+ */
3401
+ healthCheck(): Promise<HealthCheckResponse>;
3402
+ /**
3403
+ * Clear cache
3404
+ */
3405
+ clearCache(): void;
3406
+ /**
3407
+ * Clean expired cache entries
3408
+ */
3409
+ cleanCache(): void;
3410
+ /**
3411
+ * Get cache statistics
3412
+ */
3413
+ getCacheStats(): {
3414
+ size: number;
3415
+ keys: string[];
3416
+ };
3417
+ /**
3418
+ * Get underlying client
3419
+ */
3420
+ getClient(): CloudClient;
3421
+ }
3422
+
3423
+ /**
3424
+ * Type definitions for the project analysis engine
3425
+ */
3426
+ interface ProjectAnalysis {
3427
+ /** Project root directory */
3428
+ rootPath: string;
3429
+ /** Detected project type (primary language/framework) */
3430
+ projectType: string;
3431
+ /** All detected languages with confidence scores */
3432
+ languages: LanguageDetection[];
3433
+ /** Detected frameworks and libraries */
3434
+ frameworks: FrameworkDetectionResult[];
3435
+ /** Package manager used */
3436
+ packageManager?: PackageManager;
3437
+ /** Build system detected */
3438
+ buildSystem?: BuildSystem;
3439
+ /** Relative paths to important configuration files */
3440
+ configFiles: string[];
3441
+ /** Relative paths to important directories */
3442
+ importantDirs: string[];
3443
+ /** Dependency analysis results */
3444
+ dependencies?: DependencyAnalysis;
3445
+ /** Analysis metadata */
3446
+ metadata: AnalysisMetadata;
3447
+ }
3448
+ interface LanguageDetection {
3449
+ /** Language name (typescript, python, go, rust, etc.) */
3450
+ language: string;
3451
+ /** Confidence score (0-1) */
3452
+ confidence: number;
3453
+ /** Estimated number of files */
3454
+ fileCount: number;
3455
+ /** Primary indication reasons */
3456
+ indicators: string[];
3457
+ }
3458
+ interface FrameworkDetectionResult {
3459
+ /** Framework name */
3460
+ name: string;
3461
+ /** Framework category (frontend, backend, mobile, desktop, etc.) */
3462
+ category: string;
3463
+ /** Detected version if available */
3464
+ version?: string;
3465
+ /** Confidence score (0-1) */
3466
+ confidence: number;
3467
+ /** Detection evidence */
3468
+ evidence: string[];
3469
+ }
3470
+ type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'pip' | 'poetry' | 'pipenv' | 'conda' | 'go' | 'cargo' | 'mod' | 'gradle' | 'maven' | 'unknown';
3471
+ type BuildSystem = 'webpack' | 'vite' | 'rollup' | 'esbuild' | 'tsc' | 'babel' | 'swc' | 'next' | 'nuxt' | 'svelte' | 'make' | 'cmake' | 'bazel' | 'unknown';
3472
+ interface DependencyAnalysis {
3473
+ /** Direct dependencies */
3474
+ direct: DependencyNode[];
3475
+ /** All transitive dependencies */
3476
+ all: DependencyNode[];
3477
+ /** Dependency graph (key = dependency name, value = array of dependents) */
3478
+ graph: Map<string, DependencyNode[]>;
3479
+ /** Installation plan with optimal order */
3480
+ installationPlan: InstallationPlan;
3481
+ /** Detected conflicts */
3482
+ conflicts: DependencyConflict[];
3483
+ /** Circular dependencies detected */
3484
+ circularDeps: string[][];
3485
+ }
3486
+ interface DependencyNode {
3487
+ /** Package/dependency name */
3488
+ name: string;
3489
+ /** Version requirement */
3490
+ version: string;
3491
+ /** Type of dependency */
3492
+ type: DependencyType;
3493
+ /** Whether this is a dev dependency */
3494
+ isDev: boolean;
3495
+ /** Whether this is a peer dependency */
3496
+ isPeer: boolean;
3497
+ /** Whether this is an optional dependency */
3498
+ isOptional: boolean;
3499
+ /** Dependencies of this dependency */
3500
+ dependencies?: DependencyNode[];
3501
+ }
3502
+ type DependencyType = 'runtime' | 'dev' | 'peer' | 'optional' | 'bundled';
3503
+ interface InstallationPlan {
3504
+ /** Ordered list of dependencies to install */
3505
+ order: DependencyNode[];
3506
+ /** Total number of dependencies */
3507
+ total: number;
3508
+ /** Number that can be installed in parallel */
3509
+ parallelizable: number;
3510
+ /** Installation commands for each package manager */
3511
+ commands: InstallationCommands;
3512
+ }
3513
+ interface InstallationCommands {
3514
+ /** Command to install all dependencies */
3515
+ installAll: string;
3516
+ /** Command to install a specific package */
3517
+ installPackage: (name: string, version?: string) => string;
3518
+ /** Command to install dev dependencies */
3519
+ installDev: string;
3520
+ /** Command to add a new dependency */
3521
+ add: (name: string, isDev?: boolean) => string;
3522
+ }
3523
+ interface DependencyConflict {
3524
+ /** Package name with conflict */
3525
+ package: string;
3526
+ /** Conflicting version requirements */
3527
+ versions: string[];
3528
+ /** Packages requiring these versions */
3529
+ requiredBy: string[];
3530
+ /** Severity level */
3531
+ severity: 'error' | 'warning' | 'info';
3532
+ }
3533
+ interface AnalysisMetadata {
3534
+ /** Analysis timestamp */
3535
+ timestamp: Date;
3536
+ /** Analysis duration in milliseconds */
3537
+ duration: number;
3538
+ /** Number of files scanned */
3539
+ filesScanned: number;
3540
+ /** Analysis confidence (0-1) */
3541
+ confidence: number;
3542
+ /** Analysis version */
3543
+ version: string;
3544
+ }
3545
+
3546
+ type HookType = 'pre-commit' | 'post-commit' | 'pre-push' | 'post-push' | 'pre-test' | 'post-test' | 'pre-build' | 'post-build' | 'pre-install' | 'post-install' | 'pre-start' | 'post-start' | 'custom';
3547
+ type HookCategory = 'pre-commit' | 'post-test' | 'lifecycle' | 'custom';
3548
+ interface HookTrigger {
3549
+ matcher: string;
3550
+ condition?: string;
3551
+ parameters?: Record<string, any>;
3552
+ }
3553
+ interface HookAction {
3554
+ command: string;
3555
+ args?: string[];
3556
+ workingDirectory?: string;
3557
+ environment?: Record<string, string>;
3558
+ timeout?: number;
3559
+ }
3560
+ interface HookMetadata {
3561
+ version?: string;
3562
+ author?: string;
3563
+ tags?: string[];
3564
+ projectTypes?: string[];
3565
+ created?: string;
3566
+ updated?: string;
3567
+ ccjkVersion?: string;
3568
+ }
3569
+ interface HookTemplate {
3570
+ name: string;
3571
+ description: string;
3572
+ type: HookType;
3573
+ category: HookCategory;
3574
+ projectTypes: string[];
3575
+ trigger: HookTrigger;
3576
+ action: HookAction;
3577
+ enabled: boolean;
3578
+ priority: number;
3579
+ metadata?: HookMetadata;
3580
+ }
3581
+
3582
+ /**
3583
+ * Get hook recommendations from cloud service
3584
+ */
3585
+ declare function getCloudRecommendedHooks(projectInfo: ProjectAnalysis, options?: {
3586
+ includeCommunity?: boolean;
3587
+ includePremium?: boolean;
3588
+ limit?: number;
3589
+ }): Promise<HookTemplate[]>;
3590
+ /**
3591
+ * Submit hook usage analytics
3592
+ */
3593
+ declare function submitHookAnalytics(hookName: string, projectInfo: ProjectAnalysis, result: 'installed' | 'skipped' | 'error'): Promise<void>;
3594
+ /**
3595
+ * Get popular hooks from community
3596
+ */
3597
+ declare function getCommunityHooks(limit?: number, category?: string): Promise<HookTemplate[]>;
3598
+
3599
+ /**
3600
+ * Agent Template Loader
3601
+ *
3602
+ * Loads and manages agent templates from templates/agents directory
3603
+ */
3604
+ /**
3605
+ * Agent recommendation structure (simplified from templates)
3606
+ */
3607
+ interface AgentRecommendation {
3608
+ name: string;
3609
+ description: string;
3610
+ skills: string[];
3611
+ mcpServers: string[];
3612
+ persona?: string;
3613
+ capabilities: string[];
3614
+ confidence: number;
3615
+ reason: string;
3616
+ }
3617
+
3618
+ /**
3619
+ * Cloud Recommendations
3620
+ *
3621
+ * Provides agent recommendations from cloud service
3622
+ */
3623
+
3624
+ /**
3625
+ * Get agent recommendations from cloud
3626
+ */
3627
+ declare function getCloudRecommendations(analysis: ProjectAnalysis): Promise<AgentRecommendation[]>;
3628
+ /**
3629
+ * Get skill recommendations from cloud
3630
+ */
3631
+ declare function getCloudSkillRecommendations(analysis: ProjectAnalysis): Promise<any[]>;
3632
+ /**
3633
+ * Get MCP recommendations from cloud
3634
+ */
3635
+ declare function getCloudMcpRecommendations(analysis: ProjectAnalysis): Promise<any[]>;
3636
+
3637
+ /**
3638
+ * Retry wrapper for async functions
3639
+ *
3640
+ * @param fn - Function to retry
3641
+ * @param config - Retry configuration
3642
+ * @returns Promise that resolves with function result
3643
+ */
3644
+ declare function withRetry<T>(fn: () => Promise<T>, config?: Partial<RetryConfig>): Promise<T>;
3645
+ /**
3646
+ * Retryable Cloud Client
3647
+ *
3648
+ * Wraps CloudClient with retry logic
3649
+ */
3650
+ declare class RetryableCloudClient {
3651
+ private client;
3652
+ private retryConfig;
3653
+ constructor(client: CloudClient, retryConfig?: Partial<RetryConfig>);
3654
+ /**
3655
+ * Analyze project with retry
3656
+ */
3657
+ analyzeProject: (request: ProjectAnalysisRequest) => Promise<ProjectAnalysisResponse>;
3658
+ /**
3659
+ * Get template with retry
3660
+ */
3661
+ getTemplate: (id: string, language?: string) => Promise<TemplateResponse>;
3662
+ /**
3663
+ * Get batch templates with retry
3664
+ */
3665
+ getBatchTemplates: (request: BatchTemplateRequest) => Promise<BatchTemplateResponse$1>;
3666
+ /**
3667
+ * Report usage (no retry)
3668
+ */
3669
+ reportUsage: (report: UsageReport) => Promise<UsageReportResponse>;
3670
+ /**
3671
+ * Health check (no retry)
3672
+ */
3673
+ healthCheck: () => Promise<HealthCheckResponse>;
3674
+ /**
3675
+ * Get underlying client
3676
+ */
3677
+ getClient(): CloudClient;
3678
+ }
3679
+ /**
3680
+ * Retry utilities
3681
+ */
3682
+ declare const retryUtils: {
3683
+ /**
3684
+ * Retry a function with exponential backoff
3685
+ */
3686
+ withRetry: typeof withRetry;
3687
+ /**
3688
+ * Calculate retry delay
3689
+ */
3690
+ calculateDelay(attempt: number, initialDelay?: number, multiplier?: number, maxDelay?: number): number;
3691
+ /**
3692
+ * Check if error is retryable
3693
+ */
3694
+ isRetryable(error: unknown): boolean;
3695
+ };
3696
+
3697
+ /**
3698
+ * CCJK Cloud Templates Client
3699
+ *
3700
+ * Client for v8 Templates API - unified template management for Agent, MCP, Skill, Hook
3701
+ * @module cloud-client/templates-client
3702
+ */
3703
+ type TemplateType = 'skill' | 'mcp' | 'agent' | 'hook';
3704
+ interface Template {
3705
+ id: string;
3706
+ type: TemplateType;
3707
+ name_en: string;
3708
+ name_zh_cn?: string;
3709
+ description_en?: string;
3710
+ description_zh_cn?: string;
3711
+ category: string;
3712
+ tags: string[];
3713
+ template_content?: string;
3714
+ content?: string;
3715
+ author?: string;
3716
+ version: string;
3717
+ repository_url?: string;
3718
+ npm_package?: string;
3719
+ install_command?: string;
3720
+ documentation_url?: string;
3721
+ config_schema?: Record<string, unknown>;
3722
+ requirements?: string[];
3723
+ compatibility?: {
3724
+ platforms?: string[];
3725
+ frameworks?: string[];
3726
+ languages?: string[];
3727
+ [key: string]: unknown;
3728
+ };
3729
+ usage_examples?: Array<{
3730
+ title: string;
3731
+ description: string;
3732
+ code: string;
3733
+ }>;
3734
+ is_official: boolean;
3735
+ is_featured: boolean;
3736
+ is_verified: boolean;
3737
+ download_count: number;
3738
+ rating_average: number;
3739
+ rating_count: number;
3740
+ last_updated?: string;
3741
+ created_at: string;
3742
+ updated_at: string;
3743
+ }
3744
+ interface TemplateSearchParams {
3745
+ query?: string;
3746
+ type?: TemplateType;
3747
+ category?: string;
3748
+ tags?: string[];
3749
+ is_official?: boolean;
3750
+ is_featured?: boolean;
3751
+ is_verified?: boolean;
3752
+ sortBy?: 'name_en' | 'download_count' | 'rating_average' | 'updated_at';
3753
+ order?: 'asc' | 'desc';
3754
+ limit?: number;
3755
+ offset?: number;
3756
+ }
3757
+ interface TemplateListResponse {
3758
+ items: Template[];
3759
+ total: number;
3760
+ limit: number;
3761
+ offset: number;
3762
+ }
3763
+ interface BatchTemplateResponse {
3764
+ requestId: string;
3765
+ templates: Record<string, Template>;
3766
+ notFound: string[];
3767
+ stats?: {
3768
+ totalTemplates: number;
3769
+ cacheHits: number;
3770
+ cacheMisses: number;
3771
+ cacheSize: number;
3772
+ };
3773
+ }
3774
+ interface TemplatesClientConfig {
3775
+ baseURL?: string;
3776
+ timeout?: number;
3777
+ language?: 'en' | 'zh-CN';
3778
+ }
3779
+ /**
3780
+ * CCJK Cloud Templates Client
3781
+ *
3782
+ * Provides methods to interact with the v8 Templates API
3783
+ */
3784
+ declare class TemplatesClient {
3785
+ private fetch;
3786
+ private baseURL;
3787
+ private language;
3788
+ private logger;
3789
+ constructor(config?: TemplatesClientConfig);
3790
+ /**
3791
+ * Get a single template by ID
3792
+ */
3793
+ getTemplate(templateId: string): Promise<Template | null>;
3794
+ /**
3795
+ * Batch get templates by IDs
3796
+ */
3797
+ getTemplates(ids: string[], language?: 'en' | 'zh-CN'): Promise<BatchTemplateResponse>;
3798
+ /**
3799
+ * Search templates
3800
+ */
3801
+ searchTemplates(query: string, params?: Omit<TemplateSearchParams, 'query'>): Promise<TemplateListResponse>;
3802
+ /**
3803
+ * List templates with filters
3804
+ */
3805
+ listTemplates(params?: TemplateSearchParams): Promise<TemplateListResponse>;
3806
+ /**
3807
+ * Get templates by type
3808
+ */
3809
+ getTemplatesByType(type: TemplateType, options?: {
3810
+ category?: string;
3811
+ limit?: number;
3812
+ is_official?: boolean;
3813
+ }): Promise<Template[]>;
3814
+ /**
3815
+ * Get specialist agents
3816
+ */
3817
+ getSpecialistAgents(category?: string): Promise<Template[]>;
3818
+ /**
3819
+ * Get official MCP servers
3820
+ */
3821
+ getOfficialMcpServers(): Promise<Template[]>;
3822
+ /**
3823
+ * Get skills by category
3824
+ */
3825
+ getSkills(category?: string): Promise<Template[]>;
3826
+ /**
3827
+ * Get hooks by category
3828
+ */
3829
+ getHooks(category?: string): Promise<Template[]>;
3830
+ /**
3831
+ * Get featured templates
3832
+ */
3833
+ getFeaturedTemplates(limit?: number): Promise<Template[]>;
3834
+ /**
3835
+ * Get popular templates
3836
+ */
3837
+ getPopularTemplates(limit?: number): Promise<Template[]>;
3838
+ /**
3839
+ * Get all categories
3840
+ */
3841
+ getCategories(): Promise<string[]>;
3842
+ /**
3843
+ * Track template download
3844
+ */
3845
+ trackDownload(templateId: string): Promise<boolean>;
3846
+ /**
3847
+ * Build search params string
3848
+ */
3849
+ private buildSearchParams;
3850
+ /**
3851
+ * Extract localized name from template
3852
+ */
3853
+ getLocalizedName(template: Template, lang?: 'en' | 'zh-CN'): string;
3854
+ /**
3855
+ * Extract localized description from template
3856
+ */
3857
+ getLocalizedDescription(template: Template, lang?: 'en' | 'zh-CN'): string;
3858
+ }
3859
+ /**
3860
+ * Get or create the singleton TemplatesClient instance
3861
+ */
3862
+ declare function getTemplatesClient(config?: TemplatesClientConfig): TemplatesClient;
3863
+ /**
3864
+ * Create a new TemplatesClient instance
3865
+ */
3866
+ declare function createTemplatesClient(config?: TemplatesClientConfig): TemplatesClient;
3867
+
3868
+ /**
3869
+ * Standardized Cloud Client Error Handling
3870
+ *
3871
+ * Provides unified error codes, localized messages, and utility functions
3872
+ * for all cloud client operations.
3873
+ *
3874
+ * @module cloud-client/errors
3875
+ */
3876
+ /**
3877
+ * Standard cloud error codes
3878
+ */
3879
+ declare enum CloudErrorCode {
3880
+ /** Authentication failed (401) */
3881
+ AUTH_ERROR = "AUTH_ERROR",
3882
+ /** Rate limit exceeded (429) */
3883
+ RATE_LIMIT = "RATE_LIMIT",
3884
+ /** Response schema mismatch or validation error */
3885
+ SCHEMA_MISMATCH = "SCHEMA_MISMATCH",
3886
+ /** Network connection error */
3887
+ NETWORK_ERROR = "NETWORK_ERROR",
3888
+ /** Request timeout */
3889
+ TIMEOUT = "TIMEOUT",
3890
+ /** Server error (5xx) */
3891
+ SERVER_ERROR = "SERVER_ERROR",
3892
+ /** Resource not found (404) */
3893
+ NOT_FOUND = "NOT_FOUND",
3894
+ /** Generic API error (4xx) */
3895
+ API_ERROR = "API_ERROR",
3896
+ /** Validation error (client-side) */
3897
+ VALIDATION_ERROR = "VALIDATION_ERROR",
3898
+ /** Unknown error */
3899
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
3900
+ }
3901
+ /**
3902
+ * Cloud error metadata
3903
+ */
3904
+ interface CloudErrorMetadata {
3905
+ /** HTTP status code if applicable */
3906
+ statusCode?: number;
3907
+ /** Original error object */
3908
+ originalError?: unknown;
3909
+ /** Additional context data */
3910
+ context?: Record<string, any>;
3911
+ /** Retry attempt number */
3912
+ retryAttempt?: number;
3913
+ /** Request ID for tracking */
3914
+ requestId?: string;
3915
+ }
3916
+ /**
3917
+ * Standardized Cloud Error Class
3918
+ *
3919
+ * Extends Error with cloud-specific error codes and localized messages
3920
+ */
3921
+ declare class CloudError extends Error {
3922
+ /** Error code */
3923
+ readonly code: CloudErrorCode;
3924
+ /** HTTP status code if applicable */
3925
+ readonly statusCode?: number;
3926
+ /** Original error */
3927
+ readonly originalError?: unknown;
3928
+ /** Additional context */
3929
+ readonly context?: Record<string, any>;
3930
+ /** Retry attempt number */
3931
+ readonly retryAttempt?: number;
3932
+ /** Request ID */
3933
+ readonly requestId?: string;
3934
+ /** Whether this error is retryable */
3935
+ readonly isRetryable: boolean;
3936
+ constructor(code: CloudErrorCode, message: string, metadata?: CloudErrorMetadata);
3937
+ /**
3938
+ * Get localized error message
3939
+ */
3940
+ getLocalizedMessage(language?: string): string;
3941
+ /**
3942
+ * Get user-friendly error message with context
3943
+ */
3944
+ getUserMessage(language?: string): string;
3945
+ /**
3946
+ * Convert to JSON for logging
3947
+ */
3948
+ toJSON(): Record<string, any>;
3949
+ }
3950
+ /**
3951
+ * Error factory functions
3952
+ */
3953
+ declare const CloudErrorFactory: {
3954
+ /**
3955
+ * Create error from HTTP response
3956
+ */
3957
+ fromHttpStatus(statusCode: number, message: string, metadata?: Omit<CloudErrorMetadata, "statusCode">): CloudError;
3958
+ /**
3959
+ * Create authentication error
3960
+ */
3961
+ auth(message?: string, metadata?: CloudErrorMetadata): CloudError;
3962
+ /**
3963
+ * Create rate limit error
3964
+ */
3965
+ rateLimit(message?: string, metadata?: CloudErrorMetadata): CloudError;
3966
+ /**
3967
+ * Create schema mismatch error
3968
+ */
3969
+ schemaMismatch(message?: string, metadata?: CloudErrorMetadata): CloudError;
3970
+ /**
3971
+ * Create network error
3972
+ */
3973
+ network(error: unknown, metadata?: CloudErrorMetadata): CloudError;
3974
+ /**
3975
+ * Create timeout error
3976
+ */
3977
+ timeout(timeoutMs: number, metadata?: CloudErrorMetadata): CloudError;
3978
+ /**
3979
+ * Create server error
3980
+ */
3981
+ server(message?: string, metadata?: CloudErrorMetadata): CloudError;
3982
+ /**
3983
+ * Create not found error
3984
+ */
3985
+ notFound(resource?: string, metadata?: CloudErrorMetadata): CloudError;
3986
+ /**
3987
+ * Create validation error
3988
+ */
3989
+ validation(message: string, metadata?: CloudErrorMetadata): CloudError;
3990
+ /**
3991
+ * Create unknown error
3992
+ */
3993
+ unknown(error: unknown, metadata?: CloudErrorMetadata): CloudError;
3994
+ };
3995
+ /**
3996
+ * Error handling utilities
3997
+ */
3998
+ /**
3999
+ * Check if error code is retryable
4000
+ */
4001
+ declare function isRetryableErrorCode(code: CloudErrorCode): boolean;
4002
+ /**
4003
+ * Check if error is retryable
4004
+ */
4005
+ declare function isRetryableError(error: unknown): boolean;
4006
+ /**
4007
+ * Check if error is authentication error
4008
+ */
4009
+ declare function isAuthError(error: unknown): boolean;
4010
+ /**
4011
+ * Check if error is rate limit error
4012
+ */
4013
+ declare function isRateLimitError(error: unknown): boolean;
4014
+ /**
4015
+ * Handle cloud error with logging and user-friendly message
4016
+ */
4017
+ declare function handleCloudError(error: unknown, context?: string, language?: string): CloudError;
4018
+ /**
4019
+ * Get retry delay for error (exponential backoff)
4020
+ */
4021
+ declare function getRetryDelay(error: CloudError, attempt: number, config?: {
4022
+ initialDelay?: number;
4023
+ multiplier?: number;
4024
+ maxDelay?: number;
4025
+ }): number;
4026
+ /**
4027
+ * Format error for logging
4028
+ */
4029
+ declare function formatErrorForLogging(error: unknown): Record<string, any>;
4030
+
4031
+ /**
4032
+ * Pagination information
4033
+ */
4034
+ interface Pagination {
4035
+ /** Current page number (1-indexed) */
4036
+ page: number;
4037
+ /** Number of items per page */
4038
+ limit: number;
4039
+ /** Total number of items */
4040
+ total: number;
4041
+ /** Total number of pages */
4042
+ totalPages: number;
4043
+ /** Whether there are more pages */
4044
+ hasNext: boolean;
4045
+ }
4046
+ /**
4047
+ * User quota information
4048
+ */
4049
+ interface Quota {
4050
+ /** Number of skills currently installed */
4051
+ used: number;
4052
+ /** Maximum number of skills allowed */
4053
+ limit: number;
4054
+ /** Remaining skill slots */
4055
+ remaining: number;
4056
+ /** User's subscription tier */
4057
+ tier: 'free' | 'pro' | 'enterprise';
4058
+ }
4059
+ /**
4060
+ * Skill category enumeration
4061
+ */
4062
+ type SkillCategory = 'development' | 'productivity' | 'writing' | 'analysis' | 'automation' | 'integration' | 'utility' | 'other';
4063
+ /**
4064
+ * Skill provider enumeration
4065
+ */
4066
+ type SkillProvider = 'official' | 'community' | 'verified' | 'third-party';
4067
+ /**
4068
+ * Skill status enumeration
4069
+ */
4070
+ type SkillStatus = 'active' | 'deprecated' | 'beta' | 'archived';
4071
+ /**
4072
+ * Supported AI agents
4073
+ */
4074
+ type SupportedAgent = 'claude-code' | 'codex' | 'aider' | 'continue' | 'cline' | 'cursor';
4075
+ /**
4076
+ * Skill metadata
4077
+ */
4078
+ interface SkillMetadata {
4079
+ /** Minimum required version */
4080
+ minVersion?: string;
4081
+ /** Maximum supported version */
4082
+ maxVersion?: string;
4083
+ /** Required dependencies */
4084
+ dependencies?: string[];
4085
+ /** Skill configuration schema */
4086
+ configSchema?: Record<string, unknown>;
4087
+ /** Additional custom metadata */
4088
+ [key: string]: unknown;
4089
+ }
4090
+ /**
4091
+ * Complete skill information
4092
+ */
4093
+ interface Skill {
4094
+ /** Unique skill identifier */
4095
+ skillId: string;
4096
+ /** Skill name (English) */
4097
+ name: string;
4098
+ /** URL-friendly slug */
4099
+ slug: string;
4100
+ /** Skill name (Chinese) */
4101
+ nameZh: string;
4102
+ /** Description (English) */
4103
+ descriptionEn: string;
4104
+ /** Description (Chinese) */
4105
+ descriptionZh: string;
4106
+ /** Source repository name */
4107
+ repo: string;
4108
+ /** Source repository URL */
4109
+ repoUrl: string;
4110
+ /** GitHub stars count */
4111
+ stars: number;
4112
+ /** Total cloud install count */
4113
+ installCount: number;
4114
+ /** Local install count (from CLI) */
4115
+ localInstallCount: number;
4116
+ /** Skill category */
4117
+ category: SkillCategory;
4118
+ /** Skill tags for filtering */
4119
+ tags: string[];
4120
+ /** Skill provider type */
4121
+ provider: SkillProvider;
4122
+ /** Whether this is an official Anthropic skill */
4123
+ isOfficial: boolean;
4124
+ /** Whether this skill is verified */
4125
+ isVerified: boolean;
4126
+ /** Whether this skill is currently trending */
4127
+ isTrending: boolean;
4128
+ /** Trending rank (null if not trending) */
4129
+ trendingRank: number | null;
4130
+ /** Trigger command (e.g., "/commit") */
4131
+ trigger: string;
4132
+ /** Alternative trigger aliases */
4133
+ aliases: string[];
4134
+ /** CLI installation command */
4135
+ installCommand: string;
4136
+ /** List of supported AI agents */
4137
+ supportedAgents: SupportedAgent[];
4138
+ /** Average rating (1-5) */
4139
+ ratingAvg: number;
4140
+ /** Total number of ratings */
4141
+ ratingCount: number;
4142
+ /** Number of times searched */
4143
+ searchCount: number;
4144
+ /** Current skill status */
4145
+ status: SkillStatus;
4146
+ /** Additional metadata */
4147
+ metadata: SkillMetadata;
4148
+ /** Creation timestamp (ISO 8601) */
4149
+ createdAt: string;
4150
+ /** Last update timestamp (ISO 8601) */
4151
+ updatedAt: string;
4152
+ }
4153
+ /**
4154
+ * User's installed skill with usage information
4155
+ */
4156
+ interface UserSkill {
4157
+ /** Skill identifier */
4158
+ skillId: string;
4159
+ /** Skill name */
4160
+ name: string;
4161
+ /** Installation timestamp (ISO 8601) */
4162
+ installedAt: string;
4163
+ /** Last usage timestamp (ISO 8601, null if never used) */
4164
+ lastUsedAt: string | null;
4165
+ /** Total usage count */
4166
+ usageCount: number;
4167
+ /** Whether the skill is enabled */
4168
+ isEnabled: boolean;
4169
+ /** User's custom configuration */
4170
+ config: Record<string, unknown>;
4171
+ }
4172
+ /**
4173
+ * Skill rating/review
4174
+ */
4175
+ interface Rating {
4176
+ /** Unique rating identifier */
4177
+ id: string;
4178
+ /** User ID who created the rating */
4179
+ userId: string;
4180
+ /** Display name of the user */
4181
+ userName: string;
4182
+ /** Skill being rated */
4183
+ skillId: string;
4184
+ /** Rating value (1-5) */
4185
+ rating: number;
4186
+ /** Optional review text */
4187
+ review: string | null;
4188
+ /** Number of users who found this helpful */
4189
+ helpful: number;
4190
+ /** Creation timestamp (ISO 8601) */
4191
+ createdAt: string;
4192
+ /** Last update timestamp (ISO 8601) */
4193
+ updatedAt: string;
4194
+ }
4195
+ /**
4196
+ * Rating summary statistics
4197
+ */
4198
+ interface RatingSummary {
4199
+ /** Average rating */
4200
+ average: number;
4201
+ /** Total number of ratings */
4202
+ count: number;
4203
+ /** Distribution by star count */
4204
+ distribution: {
4205
+ 1: number;
4206
+ 2: number;
4207
+ 3: number;
4208
+ 4: number;
4209
+ 5: number;
4210
+ };
4211
+ }
4212
+ /**
4213
+ * Parameters for marketplace listing
4214
+ */
4215
+ interface MarketplaceParams {
4216
+ /** Page number (1-indexed, default: 1) */
4217
+ page?: number;
4218
+ /** Items per page (default: 20, max: 100) */
4219
+ limit?: number;
4220
+ /** Filter by category */
4221
+ category?: SkillCategory;
4222
+ /** Filter by provider */
4223
+ provider?: SkillProvider;
4224
+ /** Sort order */
4225
+ sort?: 'popular' | 'newest' | 'rating' | 'trending' | 'name';
4226
+ /** Filter official skills only */
4227
+ isOfficial?: boolean;
4228
+ /** Filter trending skills only */
4229
+ isTrending?: boolean;
4230
+ }
4231
+ /**
4232
+ * Parameters for skill search
4233
+ */
4234
+ interface SearchParams {
4235
+ /** Search query string */
4236
+ q: string;
4237
+ /** Filter by category */
4238
+ category?: SkillCategory;
4239
+ /** Filter by provider */
4240
+ provider?: SkillProvider;
4241
+ /** Maximum results (default: 20) */
4242
+ limit?: number;
4243
+ /** Offset for pagination (default: 0) */
4244
+ offset?: number;
4245
+ }
4246
+ /**
4247
+ * Parameters for search suggestions
4248
+ */
4249
+ interface SuggestionsParams {
4250
+ /** Partial search query */
4251
+ q: string;
4252
+ /** Maximum suggestions (default: 10) */
4253
+ limit?: number;
4254
+ }
4255
+ /**
4256
+ * Parameters for trending skills
4257
+ */
4258
+ interface TrendingParams {
4259
+ /** Maximum results (default: 10) */
4260
+ limit?: number;
4261
+ }
4262
+ /**
4263
+ * Parameters for skill recommendations
4264
+ */
4265
+ interface RecommendationsParams {
4266
+ /** User ID for personalization */
4267
+ userId?: string;
4268
+ /** Maximum recommendations (default: 10) */
4269
+ limit?: number;
4270
+ /** Exclude already installed skills */
4271
+ excludeInstalled?: boolean;
4272
+ }
4273
+ /**
4274
+ * Request to install a skill
4275
+ */
4276
+ interface InstallSkillRequest {
4277
+ /** Skill ID to install */
4278
+ skillId: string;
4279
+ /** User's subscription tier (for quota validation) */
4280
+ userTier?: 'free' | 'pro' | 'enterprise';
4281
+ }
4282
+ /**
4283
+ * Request to update a user's skill
4284
+ */
4285
+ interface UpdateSkillRequest {
4286
+ /** Enable or disable the skill */
4287
+ isEnabled?: boolean;
4288
+ /** Custom configuration */
4289
+ config?: Record<string, unknown>;
4290
+ }
4291
+ /**
4292
+ * Available filter options
4293
+ */
4294
+ interface MarketplaceFilters {
4295
+ /** Available categories */
4296
+ categories: SkillCategory[];
4297
+ /** Available providers */
4298
+ providers: SkillProvider[];
4299
+ /** Available sort options */
4300
+ sortOptions: string[];
4301
+ }
4302
+ /**
4303
+ * Response for marketplace listing
4304
+ */
4305
+ interface MarketplaceResponse {
4306
+ /** List of skills */
4307
+ skills: Skill[];
4308
+ /** Pagination information */
4309
+ pagination: Pagination;
4310
+ /** Available filter options */
4311
+ filters: MarketplaceFilters;
4312
+ }
4313
+ /**
4314
+ * Response for skill search
4315
+ */
4316
+ interface SearchResponse {
4317
+ /** Search results */
4318
+ results: Skill[];
4319
+ /** Total matching results */
4320
+ total: number;
4321
+ /** Original search query */
4322
+ query: string;
4323
+ }
4324
+ /**
4325
+ * Search suggestion item
4326
+ */
4327
+ interface Suggestion {
4328
+ /** Suggested text */
4329
+ text: string;
4330
+ /** Suggestion type */
4331
+ type: 'skill' | 'category' | 'tag';
4332
+ /** Related skill ID (if type is 'skill') */
4333
+ skillId?: string;
4334
+ }
4335
+ /**
4336
+ * Response for search suggestions
4337
+ */
4338
+ interface SuggestionsResponse {
4339
+ /** List of suggestions */
4340
+ suggestions: Suggestion[];
4341
+ }
4342
+ /**
4343
+ * Response for trending skills
4344
+ */
4345
+ interface TrendingResponse {
4346
+ /** List of trending skills */
4347
+ trending: Skill[];
4348
+ }
4349
+ /**
4350
+ * Recommendation basis information
4351
+ */
4352
+ interface RecommendationBasis {
4353
+ /** Basis type */
4354
+ type: 'similar_users' | 'installed_skills' | 'popular' | 'category';
4355
+ /** Related skill IDs or categories */
4356
+ related: string[];
4357
+ }
4358
+ /**
4359
+ * Response for skill recommendations
4360
+ */
4361
+ interface RecommendationsResponse {
4362
+ /** List of recommended skills */
4363
+ recommendations: Skill[];
4364
+ /** Total available recommendations */
4365
+ total: number;
4366
+ /** Basis for recommendations */
4367
+ basedOn: RecommendationBasis[];
4368
+ }
4369
+ /**
4370
+ * Response for user's installed skills
4371
+ */
4372
+ interface UserSkillsResponse {
4373
+ /** List of user's installed skills */
4374
+ skills: UserSkill[];
4375
+ /** Total installed skills count */
4376
+ total: number;
4377
+ /** User's quota information */
4378
+ quota: Quota;
4379
+ }
4380
+ /**
4381
+ * Response for skill installation
4382
+ */
4383
+ interface InstallResponse {
4384
+ /** Installed skill ID */
4385
+ skillId: string;
4386
+ /** Installation timestamp (ISO 8601) */
4387
+ installedAt: string;
4388
+ /** Updated quota information */
4389
+ quota: Quota;
4390
+ }
4391
+ /**
4392
+ * Response for skill uninstallation
4393
+ */
4394
+ interface UninstallResponse {
4395
+ /** Uninstalled skill ID */
4396
+ skillId: string;
4397
+ /** Uninstallation timestamp (ISO 8601) */
4398
+ uninstalledAt: string;
4399
+ /** Updated quota information */
4400
+ quota: Quota;
4401
+ }
4402
+ /**
4403
+ * Response for skill update
4404
+ */
4405
+ interface UpdateResponse {
4406
+ /** Updated skill ID */
4407
+ skillId: string;
4408
+ /** New enabled status */
4409
+ isEnabled: boolean;
4410
+ /** Updated configuration */
4411
+ config: Record<string, unknown>;
4412
+ /** Update timestamp (ISO 8601) */
4413
+ updatedAt: string;
4414
+ }
4415
+
4416
+ /**
4417
+ * Ratings API Client
4418
+ *
4419
+ * Handles all rating-related API calls for the skills marketplace.
4420
+ * Provides functionality for fetching and creating skill ratings.
4421
+ *
4422
+ * @module ratings-api
4423
+ */
4424
+
4425
+ /** Sort options for ratings */
4426
+ type RatingSortOption = 'newest' | 'oldest' | 'highest' | 'lowest' | 'helpful';
4427
+ /**
4428
+ * Parameters for fetching skill ratings
4429
+ */
4430
+ interface GetSkillRatingsParams {
4431
+ /** Page number (1-indexed) */
4432
+ page?: number;
4433
+ /** Number of items per page */
4434
+ limit?: number;
4435
+ /** Sort order for ratings */
4436
+ sort?: RatingSortOption;
4437
+ }
4438
+ /**
4439
+ * Response structure for getSkillRatings
4440
+ */
4441
+ interface GetSkillRatingsResponse {
4442
+ /** List of ratings */
4443
+ ratings: Rating[];
4444
+ /** Summary statistics for the skill's ratings */
4445
+ summary: RatingSummary;
4446
+ /** Pagination information */
4447
+ pagination: Pagination;
4448
+ }
4449
+ /**
4450
+ * Data required to create a new rating
4451
+ */
4452
+ interface CreateRatingData {
4453
+ /** ID of the user creating the rating */
4454
+ userId: string;
4455
+ /** Rating value (1-5 stars) */
4456
+ rating: number;
4457
+ /** Optional review text */
4458
+ review?: string;
4459
+ }
4460
+ /**
4461
+ * Response structure for createRating
4462
+ */
4463
+ interface CreateRatingResponse {
4464
+ /** Unique identifier for the rating */
4465
+ id: number;
4466
+ /** ID of the skill being rated */
4467
+ skillId: string;
4468
+ /** ID of the user who created the rating */
4469
+ userId: string;
4470
+ /** Rating value (1-5 stars) */
4471
+ rating: number;
4472
+ /** Review text or null if not provided */
4473
+ review: string | null;
4474
+ /** Number of users who found this rating helpful */
4475
+ helpful: number;
4476
+ /** ISO 8601 timestamp of when the rating was created */
4477
+ createdAt: string;
4478
+ }
4479
+ /**
4480
+ * Error codes specific to ratings API
4481
+ */
4482
+ declare enum RatingsApiErrorCode {
4483
+ /** User has already rated this skill */
4484
+ DUPLICATE_RATING = "DUPLICATE_RATING",
4485
+ /** Rating value is invalid (not 1-5) */
4486
+ INVALID_RATING_VALUE = "INVALID_RATING_VALUE",
4487
+ /** Skill not found */
4488
+ SKILL_NOT_FOUND = "SKILL_NOT_FOUND",
4489
+ /** Authentication required */
4490
+ UNAUTHORIZED = "UNAUTHORIZED",
4491
+ /** Network or server error */
4492
+ NETWORK_ERROR = "NETWORK_ERROR",
4493
+ /** Unknown error */
4494
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
4495
+ }
4496
+ /**
4497
+ * Custom error class for ratings API errors
4498
+ */
4499
+ declare class RatingsApiError extends Error {
4500
+ readonly code: RatingsApiErrorCode;
4501
+ readonly statusCode?: number | undefined;
4502
+ readonly details?: unknown | undefined;
4503
+ constructor(message: string, code: RatingsApiErrorCode, statusCode?: number | undefined, details?: unknown | undefined);
4504
+ }
4505
+ /**
4506
+ * Fetches ratings for a specific skill
4507
+ *
4508
+ * Retrieves a paginated list of ratings along with summary statistics
4509
+ * and rating distribution. This endpoint does not require authentication.
4510
+ *
4511
+ * @param skillId - The unique identifier of the skill
4512
+ * @param params - Optional parameters for pagination and sorting
4513
+ * @returns Promise resolving to ratings list, summary, and pagination info
4514
+ * @throws {RatingsApiError} If the request fails
4515
+ *
4516
+ * @example
4517
+ * ```typescript
4518
+ * // Fetch first page of ratings sorted by most recent
4519
+ * const result = await getSkillRatings('skill-123', {
4520
+ * page: 1,
4521
+ * limit: 10,
4522
+ * sort: 'recent'
4523
+ * });
4524
+ *
4525
+ * console.log(`Average rating: ${result.summary.avgRating}`);
4526
+ * console.log(`Total ratings: ${result.summary.totalRatings}`);
4527
+ * ```
4528
+ */
4529
+ declare function getSkillRatings(skillId: string, params?: GetSkillRatingsParams): Promise<GetSkillRatingsResponse>;
4530
+ /**
4531
+ * Creates a new rating for a skill
4532
+ *
4533
+ * Submits a rating (1-5 stars) and optional review for a skill.
4534
+ * Requires authentication via Bearer token. Each user can only
4535
+ * rate a skill once; attempting to rate again will result in a
4536
+ * DUPLICATE_RATING error.
4537
+ *
4538
+ * @param skillId - The unique identifier of the skill to rate
4539
+ * @param data - Rating data including userId, rating value, and optional review
4540
+ * @param token - Bearer token for authentication
4541
+ * @returns Promise resolving to the created rating
4542
+ * @throws {RatingsApiError} If validation fails, user is unauthorized, or duplicate rating exists
4543
+ *
4544
+ * @example
4545
+ * ```typescript
4546
+ * // Create a 5-star rating with review
4547
+ * const rating = await createRating(
4548
+ * 'skill-123',
4549
+ * {
4550
+ * userId: 'user-456',
4551
+ * rating: 5,
4552
+ * review: 'Excellent skill! Very helpful for my workflow.'
4553
+ * },
4554
+ * 'your-auth-token'
4555
+ * );
4556
+ *
4557
+ * console.log(`Rating created with ID: ${rating.id}`);
4558
+ * ```
4559
+ *
4560
+ * @example
4561
+ * ```typescript
4562
+ * // Create a rating without review
4563
+ * const rating = await createRating(
4564
+ * 'skill-123',
4565
+ * { userId: 'user-456', rating: 4 },
4566
+ * 'your-auth-token'
4567
+ * );
4568
+ * ```
4569
+ */
4570
+ declare function createRating(skillId: string, data: CreateRatingData, token: string): Promise<CreateRatingResponse>;
4571
+ /**
4572
+ * Checks if an error is a duplicate rating error
4573
+ *
4574
+ * Utility function to easily check if a rating creation failed
4575
+ * because the user has already rated the skill.
4576
+ *
4577
+ * @param error - The error to check
4578
+ * @returns True if the error indicates a duplicate rating
4579
+ *
4580
+ * @example
4581
+ * ```typescript
4582
+ * try {
4583
+ * await createRating(skillId, data, token);
4584
+ * } catch (error) {
4585
+ * if (isDuplicateRatingError(error)) {
4586
+ * console.log('You have already rated this skill');
4587
+ * } else {
4588
+ * throw error;
4589
+ * }
4590
+ * }
4591
+ * ```
4592
+ */
4593
+ declare function isDuplicateRatingError(error: unknown): boolean;
4594
+ /**
4595
+ * Checks if an error is an authentication error
4596
+ *
4597
+ * @param error - The error to check
4598
+ * @returns True if the error indicates unauthorized access
4599
+ */
4600
+ declare function isUnauthorizedError(error: unknown): boolean;
4601
+ /**
4602
+ * Checks if an error is a skill not found error
4603
+ *
4604
+ * @param error - The error to check
4605
+ * @returns True if the error indicates the skill was not found
4606
+ */
4607
+ declare function isSkillNotFoundError(error: unknown): boolean;
4608
+ /**
4609
+ * Ratings API object for convenient access to all rating functions
4610
+ *
4611
+ * @example
4612
+ * ```typescript
4613
+ * import { ratingsApi } from './ratings-api';
4614
+ *
4615
+ * // Get ratings
4616
+ * const ratings = await ratingsApi.getSkillRatings('skill-123');
4617
+ *
4618
+ * // Create rating
4619
+ * const newRating = await ratingsApi.createRating('skill-123', data, token);
4620
+ * ```
4621
+ */
4622
+ declare const ratingsApi: {
4623
+ getSkillRatings: typeof getSkillRatings;
4624
+ createRating: typeof createRating;
4625
+ isDuplicateRatingError: typeof isDuplicateRatingError;
4626
+ isUnauthorizedError: typeof isUnauthorizedError;
4627
+ isSkillNotFoundError: typeof isSkillNotFoundError;
4628
+ };
4629
+
4630
+ /**
4631
+ * Skills Marketplace API Client
4632
+ *
4633
+ * Provides API methods for interacting with the CCJK Skills Marketplace.
4634
+ * All marketplace endpoints are public and do not require authentication.
4635
+ *
4636
+ * @module skills-marketplace-api
4637
+ */
4638
+
4639
+ /** Request options interface */
4640
+ interface RequestOptions {
4641
+ /** AbortController signal for request cancellation */
4642
+ signal?: AbortSignal;
4643
+ /** Cache TTL in milliseconds. Set to 0 to disable caching */
4644
+ cacheTtl?: number;
4645
+ /** Force refresh, bypassing cache */
4646
+ forceRefresh?: boolean;
4647
+ }
4648
+ /**
4649
+ * Get skills from the marketplace with pagination and filtering
4650
+ *
4651
+ * @param params - Query parameters for filtering and pagination
4652
+ * @param params.page - Page number (default: 1)
4653
+ * @param params.limit - Items per page (default: 20, max: 100)
4654
+ * @param params.category - Filter by category
4655
+ * @param params.provider - Filter by provider
4656
+ * @param params.sort - Sort order (popular, newest, updated, name)
4657
+ * @param params.isOfficial - Filter official skills only
4658
+ * @param params.isTrending - Filter trending skills only
4659
+ * @param options - Request options (signal, cacheTtl, forceRefresh)
4660
+ * @returns Paginated marketplace response with skills array
4661
+ *
4662
+ * @example
4663
+ * ```typescript
4664
+ * // Get first page of trending skills
4665
+ * const result = await getMarketplace({ isTrending: true, limit: 10 })
4666
+ * console.log(result.data) // Array of skills
4667
+ * console.log(result.pagination) // Pagination info
4668
+ *
4669
+ * // With request cancellation
4670
+ * const controller = new AbortController()
4671
+ * const result = await getMarketplace({}, { signal: controller.signal })
4672
+ * // Later: controller.abort()
4673
+ * ```
4674
+ */
4675
+ declare function getMarketplace(params?: MarketplaceParams, options?: RequestOptions): Promise<MarketplaceResponse>;
4676
+ /**
4677
+ * Search skills in the marketplace
4678
+ *
4679
+ * @param params - Search parameters
4680
+ * @param params.q - Search query (required)
4681
+ * @param params.category - Filter by category
4682
+ * @param params.provider - Filter by provider
4683
+ * @param params.limit - Maximum results (default: 20)
4684
+ * @param params.offset - Results offset for pagination (default: 0)
4685
+ * @param options - Request options (signal, cacheTtl, forceRefresh)
4686
+ * @returns Search results with matching skills
4687
+ *
4688
+ * @example
4689
+ * ```typescript
4690
+ * // Search for git-related skills
4691
+ * const result = await searchSkills({ q: 'git', limit: 10 })
4692
+ * console.log(result.data) // Array of matching skills
4693
+ * console.log(result.total) // Total matches
4694
+ *
4695
+ * // Search with category filter
4696
+ * const result = await searchSkills({
4697
+ * q: 'deploy',
4698
+ * category: 'devops',
4699
+ * limit: 5
4700
+ * })
4701
+ * ```
4702
+ */
4703
+ declare function searchSkills(params: SearchParams, options?: RequestOptions): Promise<SearchResponse>;
4704
+ /**
4705
+ * Get search suggestions based on partial query
4706
+ *
4707
+ * @param params - Suggestion parameters
4708
+ * @param params.q - Partial search query (required)
4709
+ * @param params.limit - Maximum suggestions (default: 10)
4710
+ * @param options - Request options (signal, cacheTtl, forceRefresh)
4711
+ * @returns Array of search suggestions
4712
+ *
4713
+ * @example
4714
+ * ```typescript
4715
+ * // Get suggestions as user types
4716
+ * const suggestions = await getSearchSuggestions({ q: 'git', limit: 5 })
4717
+ * console.log(suggestions.data) // ['git-commit', 'git-branch', ...]
4718
+ * ```
4719
+ */
4720
+ declare function getSearchSuggestions(params: SuggestionsParams, options?: RequestOptions): Promise<SuggestionsResponse>;
4721
+ /**
4722
+ * Get trending search keywords
4723
+ *
4724
+ * @param params - Trending parameters
4725
+ * @param params.limit - Maximum keywords (default: 10)
4726
+ * @param options - Request options (signal, cacheTtl, forceRefresh)
4727
+ * @returns Array of trending keywords with search counts
4728
+ *
4729
+ * @example
4730
+ * ```typescript
4731
+ * // Get top 5 trending keywords
4732
+ * const trending = await getTrendingKeywords({ limit: 5 })
4733
+ * console.log(trending.data) // [{ keyword: 'ai', count: 1234 }, ...]
4734
+ * ```
4735
+ */
4736
+ declare function getTrendingKeywords(params?: TrendingParams, options?: RequestOptions): Promise<TrendingResponse>;
4737
+ /**
4738
+ * Clear the API response cache
4739
+ *
4740
+ * @example
4741
+ * ```typescript
4742
+ * // Clear all cached responses
4743
+ * clearCache()
4744
+ * ```
4745
+ */
4746
+ declare function clearCache(): void;
4747
+ /**
4748
+ * Get current cache size
4749
+ *
4750
+ * @returns Number of cached entries
4751
+ *
4752
+ * @example
4753
+ * ```typescript
4754
+ * console.log(`Cache has ${getCacheSize()} entries`)
4755
+ * ```
4756
+ */
4757
+ declare function getCacheSize(): number;
4758
+ /**
4759
+ * Create an AbortController for request cancellation
4760
+ *
4761
+ * @returns AbortController instance
4762
+ *
4763
+ * @example
4764
+ * ```typescript
4765
+ * const controller = createAbortController()
4766
+ *
4767
+ * // Start request
4768
+ * const promise = getMarketplace({}, { signal: controller.signal })
4769
+ *
4770
+ * // Cancel if needed
4771
+ * controller.abort()
4772
+ *
4773
+ * // Handle cancellation
4774
+ * try {
4775
+ * await promise
4776
+ * } catch (error) {
4777
+ * if (error instanceof SkillsMarketplaceApiError && error.code === 'ABORT_ERROR') {
4778
+ * console.log('Request was cancelled')
4779
+ * }
4780
+ * }
4781
+ * ```
4782
+ */
4783
+ declare function createAbortController(): AbortController;
4784
+ /**
4785
+ * Skills Marketplace API client object
4786
+ *
4787
+ * Provides a unified interface for all marketplace API methods.
4788
+ *
4789
+ * @example
4790
+ * ```typescript
4791
+ * import { skillsMarketplaceApi } from './skills-marketplace-api'
4792
+ *
4793
+ * // Get marketplace skills
4794
+ * const marketplace = await skillsMarketplaceApi.getMarketplace({ limit: 10 })
4795
+ *
4796
+ * // Search skills
4797
+ * const results = await skillsMarketplaceApi.searchSkills({ q: 'git' })
4798
+ *
4799
+ * // Get suggestions
4800
+ * const suggestions = await skillsMarketplaceApi.getSearchSuggestions({ q: 'de' })
4801
+ *
4802
+ * // Get trending
4803
+ * const trending = await skillsMarketplaceApi.getTrendingKeywords()
4804
+ *
4805
+ * // Clear cache
4806
+ * skillsMarketplaceApi.clearCache()
4807
+ * ```
4808
+ */
4809
+ declare const skillsMarketplaceApi: {
4810
+ getMarketplace: typeof getMarketplace;
4811
+ searchSkills: typeof searchSkills;
4812
+ getSearchSuggestions: typeof getSearchSuggestions;
4813
+ getTrendingKeywords: typeof getTrendingKeywords;
4814
+ clearCache: typeof clearCache;
4815
+ getCacheSize: typeof getCacheSize;
4816
+ createAbortController: typeof createAbortController;
4817
+ };
4818
+
4819
+ /**
4820
+ * Telemetry reporter with batching
4821
+ */
4822
+ declare class TelemetryReporter {
4823
+ private client;
4824
+ private config;
4825
+ private events;
4826
+ private flushTimer?;
4827
+ private userId;
4828
+ constructor(client: CloudClient, config?: Partial<TelemetryConfig>);
4829
+ /**
4830
+ * Generate or load anonymous user ID
4831
+ */
4832
+ private generateUserId;
4833
+ /**
4834
+ * Start periodic flush timer
4835
+ */
4836
+ private startFlushTimer;
4837
+ /**
4838
+ * Stop flush timer
4839
+ */
4840
+ private stopFlushTimer;
4841
+ /**
4842
+ * Check if telemetry is enabled
4843
+ */
4844
+ isEnabled(): boolean;
4845
+ /**
4846
+ * Track an event (non-blocking)
4847
+ *
4848
+ * @param type - Event type
4849
+ * @param data - Additional event data
4850
+ */
4851
+ track(type: MetricType, data?: TelemetryEventData): void;
4852
+ /**
4853
+ * Track template download
4854
+ */
4855
+ trackTemplateDownload(templateId: string, templateType: string): void;
4856
+ /**
4857
+ * Track recommendation shown
4858
+ */
4859
+ trackRecommendationShown(recommendationId: string, category: string): void;
4860
+ /**
4861
+ * Track recommendation accepted
4862
+ */
4863
+ trackRecommendationAccepted(recommendationId: string, category: string): void;
4864
+ /**
4865
+ * Track analysis completed
4866
+ */
4867
+ trackAnalysisCompleted(projectType?: string, frameworks?: string[]): void;
4868
+ /**
4869
+ * Track error occurred
4870
+ */
4871
+ trackError(errorType: string, errorMessage?: string, context?: string): void;
4872
+ /**
4873
+ * Flush pending events to server (non-blocking)
4874
+ * Errors are caught and logged silently
4875
+ */
4876
+ flush(): Promise<void>;
4877
+ /**
4878
+ * Send a batch of events (non-blocking with retry budget)
4879
+ */
4880
+ private sendBatch;
4881
+ /**
4882
+ * Send telemetry with retry budget and short timeout
4883
+ * Non-blocking: failures are logged but not thrown
4884
+ */
4885
+ private sendWithRetry;
4886
+ /**
4887
+ * Stop telemetry and flush remaining events
4888
+ */
4889
+ stop(): Promise<void>;
4890
+ /**
4891
+ * Get current queue size
4892
+ */
4893
+ getQueueSize(): number;
4894
+ /**
4895
+ * Get telemetry status
4896
+ */
4897
+ getStatus(): {
4898
+ enabled: boolean;
4899
+ queueSize: number;
4900
+ userId: string;
4901
+ };
4902
+ /**
4903
+ * Report usage directly (non-blocking)
4904
+ * Fire-and-forget with retry budget and short timeout
4905
+ *
4906
+ * @param report - Usage report to send
4907
+ */
4908
+ reportUsage(report: UsageReport): void;
4909
+ }
4910
+ /**
4911
+ * Initialize telemetry
4912
+ */
4913
+ declare function initializeTelemetry(client: CloudClient, config?: Partial<TelemetryConfig>): TelemetryReporter;
4914
+ /**
4915
+ * Get global telemetry instance
4916
+ */
4917
+ declare function getTelemetry(): TelemetryReporter | undefined;
4918
+ /**
4919
+ * Stop global telemetry
4920
+ */
4921
+ declare function stopTelemetry(): Promise<void>;
4922
+ /**
4923
+ * Track event using global telemetry
4924
+ */
4925
+ declare function trackEvent(type: MetricType, data?: TelemetryEventData): void;
4926
+ /**
4927
+ * Telemetry utilities
4928
+ */
4929
+ declare const telemetryUtils: {
4930
+ /**
4931
+ * Check if telemetry is enabled
4932
+ */
4933
+ isEnabled(): boolean;
4934
+ /**
4935
+ * Track with automatic error handling
4936
+ */
4937
+ trackSafe(type: MetricType, data?: TelemetryEventData): void;
4938
+ /**
4939
+ * Get telemetry status
4940
+ */
4941
+ getStatus(): {
4942
+ enabled: boolean;
4943
+ queueSize: number;
4944
+ userId: string;
4945
+ };
4946
+ };
4947
+
4948
+ /**
4949
+ * User Skills API Client
4950
+ *
4951
+ * API client for managing user's installed skills
4952
+ * Base URL: https://api.claudehome.cn/api/v1
4953
+ * Authentication: Bearer Token
4954
+ */
4955
+
4956
+ /**
4957
+ * Request options for authenticated requests
4958
+ */
4959
+ interface AuthRequestOptions {
4960
+ /** Bearer token for authentication */
4961
+ token: string;
4962
+ /** AbortController signal for request cancellation */
4963
+ signal?: AbortSignal;
4964
+ /** Request timeout in milliseconds (default: 30000) */
4965
+ timeout?: number;
4966
+ }
4967
+ /**
4968
+ * Get user's installed skills
4969
+ *
4970
+ * @param userId - User ID
4971
+ * @param options - Authentication and request options
4972
+ * @returns User's installed skills with quota information
4973
+ *
4974
+ * @example
4975
+ * ```typescript
4976
+ * const result = await getUserSkills('user123', { token: 'auth-token' })
4977
+ * console.log(result.skills) // Array of installed skills
4978
+ * console.log(result.quota) // Quota information
4979
+ * ```
4980
+ */
4981
+ declare function getUserSkills(userId: string, options: AuthRequestOptions): Promise<UserSkillsResponse>;
4982
+ /**
4983
+ * Install a skill for a user
4984
+ *
4985
+ * @param userId - User ID
4986
+ * @param request - Installation request with skill ID
4987
+ * @param options - Authentication and request options
4988
+ * @returns Installation result with updated quota
4989
+ *
4990
+ * @example
4991
+ * ```typescript
4992
+ * const result = await installSkill(
4993
+ * 'user123',
4994
+ * { skillId: 'git-commit', userTier: 'pro' },
4995
+ * { token: 'auth-token' }
4996
+ * )
4997
+ * console.log(result.skillId) // Installed skill ID
4998
+ * console.log(result.quota) // Updated quota
4999
+ * ```
5000
+ */
5001
+ declare function installSkill(userId: string, request: InstallSkillRequest, options: AuthRequestOptions): Promise<InstallResponse>;
5002
+ /**
5003
+ * Uninstall a skill for a user
5004
+ *
5005
+ * @param userId - User ID
5006
+ * @param skillId - Skill ID to uninstall
5007
+ * @param options - Authentication and request options
5008
+ * @returns Uninstallation result with updated quota
5009
+ *
5010
+ * @example
5011
+ * ```typescript
5012
+ * const result = await uninstallSkill(
5013
+ * 'user123',
5014
+ * 'git-commit',
5015
+ * { token: 'auth-token' }
5016
+ * )
5017
+ * console.log(result.skillId) // Uninstalled skill ID
5018
+ * console.log(result.quota) // Updated quota
5019
+ * ```
5020
+ */
5021
+ declare function uninstallSkill(userId: string, skillId: string, options: AuthRequestOptions): Promise<UninstallResponse>;
5022
+ /**
5023
+ * Update a user's skill configuration
5024
+ *
5025
+ * @param userId - User ID
5026
+ * @param skillId - Skill ID to update
5027
+ * @param request - Update request with new configuration
5028
+ * @param options - Authentication and request options
5029
+ * @returns Updated skill information
5030
+ *
5031
+ * @example
5032
+ * ```typescript
5033
+ * const result = await updateSkill(
5034
+ * 'user123',
5035
+ * 'git-commit',
5036
+ * { isEnabled: true, config: { autoSign: true } },
5037
+ * { token: 'auth-token' }
5038
+ * )
5039
+ * console.log(result.isEnabled) // New enabled status
5040
+ * console.log(result.config) // Updated configuration
5041
+ * ```
5042
+ */
5043
+ declare function updateSkill(userId: string, skillId: string, request: UpdateSkillRequest, options: AuthRequestOptions): Promise<UpdateResponse>;
5044
+ /**
5045
+ * Get personalized skill recommendations for a user
5046
+ *
5047
+ * @param userId - User ID
5048
+ * @param params - Recommendation parameters
5049
+ * @param options - Authentication and request options
5050
+ * @returns Personalized skill recommendations
5051
+ *
5052
+ * @example
5053
+ * ```typescript
5054
+ * const result = await getRecommendations(
5055
+ * 'user123',
5056
+ * { limit: 5, excludeInstalled: true },
5057
+ * { token: 'auth-token' }
5058
+ * )
5059
+ * console.log(result.recommendations) // Array of recommended skills
5060
+ * console.log(result.basedOn) // Recommendation basis
5061
+ * ```
5062
+ */
5063
+ declare function getRecommendations(userId: string, params: RecommendationsParams | undefined, options: AuthRequestOptions): Promise<RecommendationsResponse>;
5064
+ /**
5065
+ * Get user's quota information
5066
+ *
5067
+ * @param userId - User ID
5068
+ * @param options - Authentication and request options
5069
+ * @returns User's quota information
5070
+ *
5071
+ * @example
5072
+ * ```typescript
5073
+ * const quota = await getUserQuota('user123', { token: 'auth-token' })
5074
+ * console.log(quota.used) // Number of installed skills
5075
+ * console.log(quota.limit) // Maximum allowed skills
5076
+ * console.log(quota.remaining) // Remaining slots
5077
+ * ```
5078
+ */
5079
+ declare function getUserQuota(userId: string, options: AuthRequestOptions): Promise<Quota>;
5080
+ /**
5081
+ * Check if a user can install more skills
5082
+ *
5083
+ * @param quota - User's quota information
5084
+ * @returns True if user can install more skills
5085
+ *
5086
+ * @example
5087
+ * ```typescript
5088
+ * const quota = await getUserQuota('user123', { token: 'auth-token' })
5089
+ * if (canInstallMore(quota)) {
5090
+ * console.log('User can install more skills')
5091
+ * }
5092
+ * ```
5093
+ */
5094
+ declare function canInstallMore(quota: Quota): boolean;
5095
+ /**
5096
+ * Get quota usage percentage
5097
+ *
5098
+ * @param quota - User's quota information
5099
+ * @returns Usage percentage (0-100)
5100
+ *
5101
+ * @example
5102
+ * ```typescript
5103
+ * const quota = await getUserQuota('user123', { token: 'auth-token' })
5104
+ * const usage = getQuotaUsagePercentage(quota)
5105
+ * console.log(`Quota usage: ${usage}%`)
5106
+ * ```
5107
+ */
5108
+ declare function getQuotaUsagePercentage(quota: Quota): number;
5109
+ /**
5110
+ * Check if a skill is installed
5111
+ *
5112
+ * @param skills - User's installed skills
5113
+ * @param skillId - Skill ID to check
5114
+ * @returns True if skill is installed
5115
+ *
5116
+ * @example
5117
+ * ```typescript
5118
+ * const result = await getUserSkills('user123', { token: 'auth-token' })
5119
+ * if (isSkillInstalled(result.skills, 'git-commit')) {
5120
+ * console.log('Skill is installed')
5121
+ * }
5122
+ * ```
5123
+ */
5124
+ declare function isSkillInstalled(skills: UserSkill[], skillId: string): boolean;
5125
+ /**
5126
+ * Get enabled skills
5127
+ *
5128
+ * @param skills - User's installed skills
5129
+ * @returns Array of enabled skills
5130
+ *
5131
+ * @example
5132
+ * ```typescript
5133
+ * const result = await getUserSkills('user123', { token: 'auth-token' })
5134
+ * const enabled = getEnabledSkills(result.skills)
5135
+ * console.log(`${enabled.length} skills are enabled`)
5136
+ * ```
5137
+ */
5138
+ declare function getEnabledSkills(skills: UserSkill[]): UserSkill[];
5139
+ /**
5140
+ * Get disabled skills
5141
+ *
5142
+ * @param skills - User's installed skills
5143
+ * @returns Array of disabled skills
5144
+ *
5145
+ * @example
5146
+ * ```typescript
5147
+ * const result = await getUserSkills('user123', { token: 'auth-token' })
5148
+ * const disabled = getDisabledSkills(result.skills)
5149
+ * console.log(`${disabled.length} skills are disabled`)
5150
+ * ```
5151
+ */
5152
+ declare function getDisabledSkills(skills: UserSkill[]): UserSkill[];
5153
+ /**
5154
+ * Sort skills by usage count
5155
+ *
5156
+ * @param skills - User's installed skills
5157
+ * @param order - Sort order (default: 'desc')
5158
+ * @returns Sorted array of skills
5159
+ *
5160
+ * @example
5161
+ * ```typescript
5162
+ * const result = await getUserSkills('user123', { token: 'auth-token' })
5163
+ * const sorted = sortByUsage(result.skills)
5164
+ * console.log('Most used skill:', sorted[0].name)
5165
+ * ```
5166
+ */
5167
+ declare function sortByUsage(skills: UserSkill[], order?: 'asc' | 'desc'): UserSkill[];
5168
+ /**
5169
+ * Sort skills by last used date
5170
+ *
5171
+ * @param skills - User's installed skills
5172
+ * @param order - Sort order (default: 'desc')
5173
+ * @returns Sorted array of skills
5174
+ *
5175
+ * @example
5176
+ * ```typescript
5177
+ * const result = await getUserSkills('user123', { token: 'auth-token' })
5178
+ * const sorted = sortByLastUsed(result.skills)
5179
+ * console.log('Recently used skill:', sorted[0].name)
5180
+ * ```
5181
+ */
5182
+ declare function sortByLastUsed(skills: UserSkill[], order?: 'asc' | 'desc'): UserSkill[];
5183
+ /**
5184
+ * User Skills API client object
5185
+ *
5186
+ * Provides a unified interface for all user skills API methods.
5187
+ *
5188
+ * @example
5189
+ * ```typescript
5190
+ * import { userSkillsApi } from './user-skills-api'
5191
+ *
5192
+ * const options = { token: 'auth-token' }
5193
+ *
5194
+ * // Get user's skills
5195
+ * const skills = await userSkillsApi.getUserSkills('user123', options)
5196
+ *
5197
+ * // Install a skill
5198
+ * const result = await userSkillsApi.installSkill(
5199
+ * 'user123',
5200
+ * { skillId: 'git-commit' },
5201
+ * options
5202
+ * )
5203
+ *
5204
+ * // Update skill
5205
+ * await userSkillsApi.updateSkill(
5206
+ * 'user123',
5207
+ * 'git-commit',
5208
+ * { isEnabled: true },
5209
+ * options
5210
+ * )
5211
+ *
5212
+ * // Uninstall skill
5213
+ * await userSkillsApi.uninstallSkill('user123', 'git-commit', options)
5214
+ *
5215
+ * // Get recommendations
5216
+ * const recommendations = await userSkillsApi.getRecommendations(
5217
+ * 'user123',
5218
+ * { limit: 5 },
5219
+ * options
5220
+ * )
5221
+ * ```
5222
+ */
5223
+ declare const userSkillsApi: {
5224
+ getUserSkills: typeof getUserSkills;
5225
+ installSkill: typeof installSkill;
5226
+ uninstallSkill: typeof uninstallSkill;
5227
+ updateSkill: typeof updateSkill;
5228
+ getRecommendations: typeof getRecommendations;
5229
+ getUserQuota: typeof getUserQuota;
5230
+ canInstallMore: typeof canInstallMore;
5231
+ getQuotaUsagePercentage: typeof getQuotaUsagePercentage;
5232
+ isSkillInstalled: typeof isSkillInstalled;
5233
+ getEnabledSkills: typeof getEnabledSkills;
5234
+ getDisabledSkills: typeof getDisabledSkills;
5235
+ sortByUsage: typeof sortByUsage;
5236
+ sortByLastUsed: typeof sortByLastUsed;
5237
+ };
5238
+
5239
+ /**
5240
+ * Fallback Cloud Client with Local Fallback Support
5241
+ *
5242
+ * When the API is unavailable, falls back to local recommendations
5243
+ */
5244
+ declare class FallbackCloudClient {
5245
+ private client;
5246
+ private fallbackEnabled;
5247
+ constructor(client: CloudClient, fallbackEnabled?: boolean);
5248
+ /**
5249
+ * Analyze project with fallback
5250
+ */
5251
+ analyzeProject(request: ProjectAnalysisRequest): Promise<ProjectAnalysisResponse>;
5252
+ /**
5253
+ * Get template with fallback
5254
+ */
5255
+ getTemplate(id: string, language?: string): Promise<TemplateResponse>;
5256
+ /**
5257
+ * Get batch templates with fallback
5258
+ */
5259
+ getBatchTemplates(request: BatchTemplateRequest): Promise<BatchTemplateResponse$1>;
5260
+ /**
5261
+ * Report usage (no fallback)
5262
+ */
5263
+ reportUsage(report: UsageReport): Promise<UsageReportResponse>;
5264
+ /**
5265
+ * Health check (no fallback)
5266
+ */
5267
+ healthCheck(): Promise<HealthCheckResponse>;
5268
+ /**
5269
+ * Get local fallback recommendations
5270
+ */
5271
+ private getLocalRecommendations;
5272
+ /**
5273
+ * Get local fallback template
5274
+ */
5275
+ private getLocalTemplate;
5276
+ /**
5277
+ * Get local fallback batch templates
5278
+ */
5279
+ private getLocalBatchTemplates;
5280
+ /**
5281
+ * Detect project type
5282
+ */
5283
+ private detectProjectType;
5284
+ /**
5285
+ * Detect frameworks
5286
+ */
5287
+ private detectFrameworks;
5288
+ }
5289
+ /**
5290
+ * Create a complete cloud client with all features
5291
+ */
5292
+ declare function createCompleteCloudClient(config?: Partial<CloudClientConfig>): FallbackCloudClient;
5293
+
5294
+ export { AiderTool, BaseCodeTool, BaseError, CachedCloudClient, ClaudeCodeTool, ClineTool, CloudCache, CloudClient, CloudClientError, CloudError, CloudErrorCode, CloudErrorFactory, CodexTool, ConfigManager, ConfigValidator, ConfigurationError, ContinueTool, CursorTool, FallbackCloudClient, InternalError, Logger, Mutex, NotFoundError, RatingsApiError, RatingsApiErrorCode, RetryableCloudClient, Semaphore, TelemetryReporter, TemplatesClient, TimeoutError, ToolFactory, ToolRegistry, UnauthorizedError, ValidationError, index$6 as array, assert, assertDefined, index$5 as async, batchProcessFiles, camelCase, canInstallMore, capitalize, chunk, index$4 as command, commandExists$1 as commandExists, config, convertBatchTemplateResponse, convertConfig, convertParameterDefault, convertProjectAnalysisResponse, convertRecommendation, convertTemplate, convertTemplateParameter, copyFile, countLines, createCloudClient, createCompleteCloudClient, createConfigManager, createLogger, createRating, createTemplatesClient, createTool, createValidator, debounce, deepClone, deepMerge, deleteDir, deleteFile, difference, ensureDir, index$3 as error, executeCommand, executeCommandStream, exists, extractDisplayName, extractString, flatten, flatten$1 as flattenArray, formatError, formatErrorForLogging, index$2 as fs, generateCompactWelcome, generateRecommendations, generateWelcome, get, getArchitecture, getCacheDir, getCapabilitiesByType, getCapability, getCloudMcpRecommendations, getCloudRecommendations, getCloudRecommendedHooks, getCloudSkillRecommendations, getCommandPath, getCommandVersion, getCommunityHooks, getConfigDir, getDataDir, getDisabledSkills, getEnabledSkills, getErrorMessage, getFileInfo, getFileSize, getHomeDir, getPlatform, getPlatformInfo, getQuotaUsagePercentage, getRecommendations, getRegistry, getRetryDelay, getSkillRatings, getTelemetry, getTempDir, getTemplatesClient, getUserQuota, getUserSkills, handleCloudError, has, i18nHelpers, initializeTelemetry, installSkill, intersection, isArray, isAuthError, isBoolean, isDefined, isDirectory, isDuplicateRatingError, isEmail, isFile, isLargeFile, isLinux, isMacOS, isNumber, isObject, isRateLimitError, isRecommendationConfig, isRetryableError, isRetryableErrorCode, isSkillInstalled, isSkillNotFoundError, isString, isTelemetryEventData, isTemplateParameterValue, isURL, isUnauthorizedError, isUnix, isWindows, kebabCase, listDirs, listFiles, logger, logger$2 as loggerUtils, moveFile, normalizeRecommendation, normalizeRecommendations, index$1 as object, omit, parallelLimit, partition, pascalCase, pick, platform, processLargeFile, processLineByLine, ratingsApi, readFile, readJSON, retry, retryUtils, scanCapabilities, sequence, set, shuffle, skillsMarketplaceApi, sleep, slugify, snakeCase, sortByLastUsed, sortByUsage, stopTelemetry, streamJSON, streamWriteJSON, index as string, submitHookAnalytics, telemetryUtils, template, throttle, timeout, trackEvent, truncate, tryCatch, tryCatchAsync, unflatten, uninstallSkill, union, unique, updateSkill, userSkillsApi, validateBatchTemplateRequest, validateProjectAnalysisRequest, validateUsageReport, validation, validators, waitFor, withRetry, wrapError, writeFile, writeJSON };
5295
+ export type { AgentConfig, AnalysisCompletedData, AuthRequestOptions, BatchTelemetryData, BatchTemplateRequest, BatchTemplateResponse$1 as BatchTemplateResponse, CacheEntry, Capability, CapabilityScanResult, CapabilityStatus, CapabilityType, ChunkProcessorOptions, CloudErrorMetadata, CreateRatingData, CreateRatingResponse, ErrorOccurredData, ExecutionResult, FileInfo, GetSkillRatingsParams, GetSkillRatingsResponse, HealthCheckResponse, HookConfig, IChatTool, ICodeGenTool, ICodeTool, IFileEditTool, InstallStatus, McpServerConfig, MetricType, MultilingualString, ProjectAnalysisRequest, ProjectAnalysisResponse, RatingSortOption, RawBatchTemplateResponse, RawProjectAnalysisResponse, RawRecommendation, RawTemplate, Recommendation, RecommendationAcceptedData, RecommendationConfig, RecommendationShownData, SkillConfig, StreamProcessorOptions, TelemetryEventData, TemplateDownloadData, TemplateParameter, TemplateParameterValue, TemplateResponse, TemplateType$1 as TemplateType, ToolCapabilities, ToolConfig, ToolMetadata, UsageReport, UsageReportResponse, WelcomeOptions, WorkflowConfig };