lettactl 0.2.0 → 0.3.0

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 (64) hide show
  1. package/README.md +57 -0
  2. package/dist/commands/apply.d.ts.map +1 -1
  3. package/dist/commands/apply.js +91 -59
  4. package/dist/commands/apply.js.map +1 -1
  5. package/dist/commands/create.d.ts.map +1 -1
  6. package/dist/commands/create.js +18 -10
  7. package/dist/commands/create.js.map +1 -1
  8. package/dist/commands/delete.d.ts +1 -1
  9. package/dist/commands/delete.d.ts.map +1 -1
  10. package/dist/commands/delete.js +13 -5
  11. package/dist/commands/delete.js.map +1 -1
  12. package/dist/commands/describe.d.ts +1 -1
  13. package/dist/commands/describe.d.ts.map +1 -1
  14. package/dist/commands/describe.js +102 -92
  15. package/dist/commands/describe.js.map +1 -1
  16. package/dist/commands/get.d.ts +1 -1
  17. package/dist/commands/get.d.ts.map +1 -1
  18. package/dist/commands/get.js +19 -9
  19. package/dist/commands/get.js.map +1 -1
  20. package/dist/commands/messages.d.ts.map +1 -1
  21. package/dist/commands/messages.js +11 -2
  22. package/dist/commands/messages.js.map +1 -1
  23. package/dist/index.js +1 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/lib/agent-manager.d.ts.map +1 -1
  26. package/dist/lib/agent-manager.js +19 -6
  27. package/dist/lib/agent-manager.js.map +1 -1
  28. package/dist/lib/block-manager.d.ts +4 -0
  29. package/dist/lib/block-manager.d.ts.map +1 -1
  30. package/dist/lib/block-manager.js +8 -0
  31. package/dist/lib/block-manager.js.map +1 -1
  32. package/dist/lib/bucket-config-validator.d.ts +20 -0
  33. package/dist/lib/bucket-config-validator.d.ts.map +1 -0
  34. package/dist/lib/bucket-config-validator.js +95 -0
  35. package/dist/lib/bucket-config-validator.js.map +1 -0
  36. package/dist/lib/config-validators.d.ts +59 -0
  37. package/dist/lib/config-validators.d.ts.map +1 -0
  38. package/dist/lib/config-validators.js +275 -0
  39. package/dist/lib/config-validators.js.map +1 -0
  40. package/dist/lib/diff-engine.d.ts +5 -0
  41. package/dist/lib/diff-engine.d.ts.map +1 -1
  42. package/dist/lib/diff-engine.js +55 -15
  43. package/dist/lib/diff-engine.js.map +1 -1
  44. package/dist/lib/file-content-tracker.d.ts +5 -2
  45. package/dist/lib/file-content-tracker.d.ts.map +1 -1
  46. package/dist/lib/file-content-tracker.js +20 -2
  47. package/dist/lib/file-content-tracker.js.map +1 -1
  48. package/dist/lib/fleet-parser.d.ts +7 -1
  49. package/dist/lib/fleet-parser.d.ts.map +1 -1
  50. package/dist/lib/fleet-parser.js +24 -3
  51. package/dist/lib/fleet-parser.js.map +1 -1
  52. package/dist/lib/spinner.d.ts +9 -0
  53. package/dist/lib/spinner.d.ts.map +1 -0
  54. package/dist/lib/spinner.js +41 -0
  55. package/dist/lib/spinner.js.map +1 -0
  56. package/dist/lib/storage-backend.d.ts +47 -0
  57. package/dist/lib/storage-backend.d.ts.map +1 -0
  58. package/dist/lib/storage-backend.js +280 -0
  59. package/dist/lib/storage-backend.js.map +1 -0
  60. package/dist/lib/storage-error-handler.d.ts +44 -0
  61. package/dist/lib/storage-error-handler.d.ts.map +1 -0
  62. package/dist/lib/storage-error-handler.js +176 -0
  63. package/dist/lib/storage-error-handler.js.map +1 -0
  64. package/package.json +5 -2
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ /**
3
+ * Storage backend interface for lettactl
4
+ * Allows reading content from various sources (filesystem, cloud storage, etc.)
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.SupabaseStorageBackend = exports.FileSystemBackend = exports.StorageBackendManager = void 0;
41
+ /**
42
+ * Storage backend manager that routes requests to appropriate backends
43
+ */
44
+ class StorageBackendManager {
45
+ constructor(options = {}) {
46
+ this.backends = [];
47
+ // Always include filesystem backend
48
+ this.backends.push(new FileSystemBackend());
49
+ // Store Supabase backend separately since it has different interface
50
+ this.supabaseBackend = options.supabaseBackend;
51
+ }
52
+ async readContent(uri) {
53
+ const backend = this.backends.find(b => b.canHandle(uri));
54
+ if (!backend) {
55
+ throw new Error(`No backend available for URI: ${uri}`);
56
+ }
57
+ return backend.readContent(uri);
58
+ }
59
+ async listFiles(pattern) {
60
+ const backend = this.backends.find(b => b.canHandle(pattern));
61
+ if (!backend) {
62
+ throw new Error(`No backend available for pattern: ${pattern}`);
63
+ }
64
+ return backend.listFiles(pattern);
65
+ }
66
+ /**
67
+ * Convert bucket config to URI for backend routing
68
+ */
69
+ async readFromBucket(config) {
70
+ // Validate bucket config structure
71
+ this.validateBucketConfig(config);
72
+ if (config.provider === 'supabase') {
73
+ if (!this.supabaseBackend) {
74
+ throw new Error('Supabase backend not configured');
75
+ }
76
+ return this.supabaseBackend.readFromBucket(config.bucket, config.path);
77
+ }
78
+ // Check for common typos
79
+ const provider = String(config.provider).toLowerCase();
80
+ if (provider.includes('supab') || provider.includes('suapb')) {
81
+ throw new Error(`Provider '${config.provider}' not recognized. Did you mean 'supabase'?`);
82
+ }
83
+ // TODO: Add s3, gcs support
84
+ throw new Error(`Provider '${config.provider}' not yet supported. Supported: supabase. Coming soon: s3, gcs`);
85
+ }
86
+ validateBucketConfig(config) {
87
+ if (!config || typeof config !== 'object') {
88
+ throw new Error('Invalid from_bucket configuration. Expected object with provider, bucket, and path fields.\n' +
89
+ 'Example:\n' +
90
+ 'from_bucket:\n' +
91
+ ' provider: supabase\n' +
92
+ ' bucket: my-bucket\n' +
93
+ ' path: file.md');
94
+ }
95
+ const requiredFields = ['provider', 'bucket', 'path'];
96
+ const missing = requiredFields.filter(field => !(field in config));
97
+ if (missing.length > 0) {
98
+ throw new Error(`Missing required fields in from_bucket config: ${missing.join(', ')}\n` +
99
+ 'Required fields: provider, bucket, path\n' +
100
+ 'Example:\n' +
101
+ 'from_bucket:\n' +
102
+ ' provider: supabase\n' +
103
+ ' bucket: my-bucket\n' +
104
+ ' path: file.md');
105
+ }
106
+ // Check for empty/null values
107
+ const emptyFields = requiredFields.filter(field => {
108
+ const value = config[field];
109
+ return value === null || value === undefined || value === '' || (typeof value === 'string' && value.trim() === '');
110
+ });
111
+ if (emptyFields.length > 0) {
112
+ throw new Error(`Empty values not allowed in from_bucket config: ${emptyFields.join(', ')}\n` +
113
+ 'All fields must have non-empty values.\n' +
114
+ 'Example:\n' +
115
+ 'from_bucket:\n' +
116
+ ' provider: supabase\n' +
117
+ ' bucket: my-bucket\n' +
118
+ ' path: file.md');
119
+ }
120
+ }
121
+ }
122
+ exports.StorageBackendManager = StorageBackendManager;
123
+ /**
124
+ * File system storage backend (existing behavior)
125
+ */
126
+ const fs = __importStar(require("fs"));
127
+ const path = __importStar(require("path"));
128
+ const glob_1 = require("glob");
129
+ class FileSystemBackend {
130
+ constructor(basePath = '') {
131
+ this.basePath = basePath;
132
+ }
133
+ canHandle(uri) {
134
+ return !uri.includes('://') || uri.startsWith('file://');
135
+ }
136
+ async readContent(uri) {
137
+ const filePath = this.resolvePath(uri);
138
+ return fs.readFileSync(filePath, 'utf8');
139
+ }
140
+ async listFiles(pattern) {
141
+ const resolvedPattern = this.resolvePath(pattern);
142
+ return (0, glob_1.globSync)(resolvedPattern);
143
+ }
144
+ resolvePath(uri) {
145
+ const cleanPath = uri.replace('file://', '');
146
+ if (path.isAbsolute(cleanPath))
147
+ return cleanPath;
148
+ return path.resolve(this.basePath, cleanPath);
149
+ }
150
+ }
151
+ exports.FileSystemBackend = FileSystemBackend;
152
+ /**
153
+ * Supabase storage backend for cloud file access
154
+ */
155
+ const supabase_js_1 = require("@supabase/supabase-js");
156
+ const storage_error_handler_1 = require("./storage-error-handler");
157
+ class SupabaseStorageBackend {
158
+ constructor() {
159
+ this.validateEnvironment();
160
+ // Use generic environment variables for standalone library
161
+ this.supabase = (0, supabase_js_1.createClient)(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY, {
162
+ auth: { persistSession: false }
163
+ });
164
+ }
165
+ validateEnvironment() {
166
+ const requiredVars = ['SUPABASE_URL', 'SUPABASE_ANON_KEY'];
167
+ const missing = [];
168
+ for (const envVar of requiredVars) {
169
+ if (!process.env[envVar]) {
170
+ missing.push(envVar);
171
+ }
172
+ }
173
+ if (missing.length > 0) {
174
+ throw new Error(`Missing required environment variables for Supabase: ${missing.join(', ')}\n\n` +
175
+ 'Set them with:\n' +
176
+ missing.map(v => `export ${v}=<your_value>`).join('\n') +
177
+ '\n\nOr add them to your .env file.');
178
+ }
179
+ // Validate URL format
180
+ const url = process.env.SUPABASE_URL;
181
+ try {
182
+ const parsed = new URL(url);
183
+ if (!parsed.protocol.startsWith('https')) {
184
+ throw new Error(`SUPABASE_URL must use HTTPS protocol, got: ${parsed.protocol}`);
185
+ }
186
+ if (!url.includes('supabase.co') && !url.includes('localhost')) {
187
+ console.warn(`Warning: SUPABASE_URL doesn't appear to be a standard Supabase URL: ${url}`);
188
+ }
189
+ }
190
+ catch (error) {
191
+ if (error instanceof Error && error.message.includes('HTTPS')) {
192
+ throw error; // Re-throw HTTPS-specific error
193
+ }
194
+ throw new Error(`Invalid SUPABASE_URL format: ${url}\n` +
195
+ 'Expected format: https://your-project.supabase.co');
196
+ }
197
+ }
198
+ async readFromBucket(bucket, filePath) {
199
+ try {
200
+ // Check file metadata first to detect empty files efficiently
201
+ const pathParts = filePath.split('/');
202
+ const fileName = pathParts.pop();
203
+ const folder = pathParts.join('/') || '';
204
+ const { data: listData, error: listError } = await this.supabase.storage
205
+ .from(bucket)
206
+ .list(folder, {
207
+ search: fileName,
208
+ limit: 1
209
+ });
210
+ if (!listError && listData) {
211
+ const fileInfo = listData.find((f) => f.name === fileName);
212
+ if (fileInfo && fileInfo.metadata?.size) {
213
+ const size = fileInfo.metadata.size;
214
+ if (size <= 40) {
215
+ console.warn(`Warning: File '${filePath}' in bucket '${bucket}' is very small (${size} bytes). Check file has meaningful content.`);
216
+ }
217
+ else if (size > 50 * 1024 * 1024) { // 50MB
218
+ console.warn(`Warning: File '${filePath}' in bucket '${bucket}' is very large (${Math.round(size / 1024 / 1024 * 100) / 100}MB). This may cause memory issues or timeouts.`);
219
+ }
220
+ }
221
+ }
222
+ const { data, error } = await this.supabase.storage
223
+ .from(bucket)
224
+ .download(filePath);
225
+ if (error) {
226
+ storage_error_handler_1.StorageErrorHandler.handleProviderError(error, {
227
+ provider: 'supabase',
228
+ operation: 'download',
229
+ bucket,
230
+ filePath
231
+ });
232
+ }
233
+ if (!data) {
234
+ storage_error_handler_1.StorageErrorHandler.handleProviderError({ message: 'No data returned from download' }, { provider: 'supabase', operation: 'download', bucket, filePath });
235
+ }
236
+ return await data.text();
237
+ }
238
+ catch (error) {
239
+ // Re-throw our custom errors, handle unexpected ones through error handler
240
+ if (error.message.includes('Failed to download')) {
241
+ throw error;
242
+ }
243
+ storage_error_handler_1.StorageErrorHandler.handleProviderError(error, {
244
+ provider: 'supabase',
245
+ operation: 'download',
246
+ bucket,
247
+ filePath
248
+ });
249
+ }
250
+ }
251
+ async listFiles(bucket, pathPrefix = '') {
252
+ try {
253
+ const { data, error } = await this.supabase.storage
254
+ .from(bucket)
255
+ .list(pathPrefix, {
256
+ limit: 1000,
257
+ sortBy: { column: 'updated_at', order: 'desc' }
258
+ });
259
+ if (error) {
260
+ storage_error_handler_1.StorageErrorHandler.handleProviderError(error, {
261
+ provider: 'supabase',
262
+ operation: 'list',
263
+ bucket,
264
+ filePath: pathPrefix
265
+ });
266
+ }
267
+ return data?.map((file) => pathPrefix ? `${pathPrefix}/${file.name}` : file.name) || [];
268
+ }
269
+ catch (error) {
270
+ storage_error_handler_1.StorageErrorHandler.handleProviderError(error, {
271
+ provider: 'supabase',
272
+ operation: 'list',
273
+ bucket,
274
+ filePath: pathPrefix
275
+ });
276
+ }
277
+ }
278
+ }
279
+ exports.SupabaseStorageBackend = SupabaseStorageBackend;
280
+ //# sourceMappingURL=storage-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-backend.js","sourceRoot":"","sources":["../../src/lib/storage-backend.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH;;GAEG;AACH,MAAa,qBAAqB;IAIhC,YAAY,UAAwD,EAAE;QAH9D,aAAQ,GAAqB,EAAE,CAAC;QAItC,oCAAoC;QACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;QAE5C,qEAAqE;QACrE,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAW;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,C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,KAAK,EAAE;gBAC7C,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE,UAAU;gBACrB,MAAM;gBACN,QAAQ;aACT,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,aAAqB,EAAE;QACrD,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO;iBAChD,IAAI,CAAC,MAAM,CAAC;iBACZ,IAAI,CAAC,UAAU,EAAE;gBAChB,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE;aAChD,CAAC,CAAA;YAEJ,IAAI,KAAK,EAAE,CAAC;gBACV,2CAAmB,CAAC,mBAAmB,CAAC,KAAK,EAAE;oBAC7C,QAAQ,EAAE,UAAU;oBACpB,SAAS,EAAE,MAAM;oBACjB,MAAM;oBACN,QAAQ,EAAE,UAAU;iBACrB,CAAC,CAAC;YACL,CAAC;YAED,OAAO,IAAI,EAAE,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAC7B,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CACtD,IAAI,EAAE,CAAA;QAET,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,2CAAmB,CAAC,mBAAmB,CAAC,KAAK,EAAE;gBAC7C,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE,MAAM;gBACjB,MAAM;gBACN,QAAQ,EAAE,UAAU;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA1JD,wDA0JC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Centralized error handling for storage backends
3
+ * Provides consistent error messages and handling across different cloud providers
4
+ */
5
+ export interface StorageErrorContext {
6
+ provider: string;
7
+ operation: string;
8
+ bucket?: string;
9
+ filePath?: string;
10
+ pattern?: string;
11
+ }
12
+ export declare class StorageErrorHandler {
13
+ /**
14
+ * Handle HTTP status-based errors with provider-specific context
15
+ */
16
+ static handleHttpError(error: any, context: StorageErrorContext, statusCode?: number): never;
17
+ /**
18
+ * Handle provider-specific errors with fallback to generic handling
19
+ */
20
+ static handleProviderError(error: any, context: StorageErrorContext): never;
21
+ /**
22
+ * Handle Supabase-specific error patterns
23
+ */
24
+ private static handleSupabaseError;
25
+ /**
26
+ * Handle AWS S3-specific error patterns
27
+ * TODO: Implement when S3 backend is added
28
+ */
29
+ private static handleS3Error;
30
+ /**
31
+ * Handle Google Cloud Storage-specific error patterns
32
+ * TODO: Implement when GCS backend is added
33
+ */
34
+ private static handleGCSError;
35
+ /**
36
+ * Generic error handling for unknown or unexpected errors
37
+ */
38
+ private static handleGenericError;
39
+ /**
40
+ * Wrap async storage operations with consistent error handling
41
+ */
42
+ static wrapStorageOperation<T>(operation: () => Promise<T>, context: StorageErrorContext): Promise<T>;
43
+ }
44
+ //# sourceMappingURL=storage-error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-error-handler.d.ts","sourceRoot":"","sources":["../../src/lib/storage-error-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,mBAAmB;IAE9B;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,mBAAmB,EAC5B,UAAU,CAAC,EAAE,MAAM,GAClB,KAAK;IAwDR;;OAEG;IACH,MAAM,CAAC,mBAAmB,CACxB,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,mBAAmB,GAC3B,KAAK;IAeR;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA6ClC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAM5B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAK7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IA4BjC;;OAEG;WACU,oBAAoB,CAAC,CAAC,EACjC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,CAAC,CAAC;CAOd"}
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ /**
3
+ * Centralized error handling for storage backends
4
+ * Provides consistent error messages and handling across different cloud providers
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.StorageErrorHandler = void 0;
8
+ class StorageErrorHandler {
9
+ /**
10
+ * Handle HTTP status-based errors with provider-specific context
11
+ */
12
+ static handleHttpError(error, context, statusCode) {
13
+ const { provider, operation, bucket, filePath } = context;
14
+ const resource = bucket && filePath ? `${bucket}/${filePath}` : bucket || filePath || 'resource';
15
+ let errorMessage = `Failed to ${operation} ${resource} (${provider})`;
16
+ const status = statusCode || error.status || error.originalError?.status;
17
+ switch (status) {
18
+ case 400:
19
+ if (provider.toLowerCase() === 'supabase') {
20
+ // Check if error indicates bucket doesn't exist
21
+ if (error.message && (error.message.includes('bucket') || error.message.includes('not found'))) {
22
+ errorMessage += `: Bucket '${bucket}' not found. Check: 1) bucket name is spelled correctly, 2) bucket exists in your Supabase project, 3) you're connected to the right project.`;
23
+ }
24
+ else {
25
+ errorMessage += `: Bad request - this could be: 1) bucket '${bucket}' doesn't exist, 2) file '${filePath}' doesn't exist, 3) bucket is private (needs RLS policy or make bucket public), 4) wrong RLS policy configuration, 5) invalid file path '${filePath}', 6) malformed request, or 7) something else (Supabase error messages aren't clear here). Check: bucket exists, file exists, is public or has proper RLS, and file path is correct.`;
26
+ }
27
+ }
28
+ else {
29
+ errorMessage += `: Bad request - this could be: 1) bucket '${bucket}' doesn't exist, 2) invalid file path '${filePath}', or 3) malformed request. Check bucket exists and path is correct.`;
30
+ }
31
+ break;
32
+ case 401:
33
+ errorMessage += `: Unauthorized. Please check your ${provider} credentials.`;
34
+ break;
35
+ case 403:
36
+ errorMessage += `: Access denied. Please check your ${provider} credentials and bucket permissions.`;
37
+ break;
38
+ case 404:
39
+ if (filePath) {
40
+ errorMessage += `: File not found. Please check that '${filePath}' exists in the '${bucket}' bucket.`;
41
+ }
42
+ else {
43
+ errorMessage += `: Resource not found. Please check the bucket or path exists.`;
44
+ }
45
+ break;
46
+ case 429:
47
+ errorMessage += `: Rate limit exceeded. Please try again later.`;
48
+ break;
49
+ case 500:
50
+ case 502:
51
+ case 503:
52
+ case 504:
53
+ errorMessage += `: ${provider} service outage or maintenance (HTTP ${status}). This is a server-side issue. Please try again in a few minutes or check ${provider} status page.`;
54
+ break;
55
+ default:
56
+ if (status >= 500 && status < 600) {
57
+ errorMessage += `: ${provider} server error (HTTP ${status}). Please try again or contact ${provider} support.`;
58
+ }
59
+ else if (status) {
60
+ errorMessage += `: HTTP ${status} error. Check ${provider} Storage configuration.`;
61
+ }
62
+ else {
63
+ errorMessage += `: Unknown error. Check ${provider} Storage configuration and network connectivity.`;
64
+ }
65
+ }
66
+ throw new Error(errorMessage);
67
+ }
68
+ /**
69
+ * Handle provider-specific errors with fallback to generic handling
70
+ */
71
+ static handleProviderError(error, context) {
72
+ const { provider } = context;
73
+ switch (provider.toLowerCase()) {
74
+ case 'supabase':
75
+ return this.handleSupabaseError(error, context);
76
+ case 's3':
77
+ return this.handleS3Error(error, context);
78
+ case 'gcs':
79
+ return this.handleGCSError(error, context);
80
+ default:
81
+ return this.handleGenericError(error, context);
82
+ }
83
+ }
84
+ /**
85
+ * Handle Supabase-specific error patterns
86
+ */
87
+ static handleSupabaseError(error, context) {
88
+ // Handle StorageUnknownError - check status to differentiate bucket vs auth issues
89
+ if (error.__isStorageError && error.name === 'StorageUnknownError') {
90
+ const status = error.originalError?.status;
91
+ if (status === 400) {
92
+ throw new Error(`Failed to ${context.operation} ${context.bucket}/${context.filePath} (supabase): ` +
93
+ `Bucket '${context.bucket}' doesn't exist. Check: 1) bucket name is spelled correctly, ` +
94
+ `2) bucket exists in your Supabase project, 3) you're connected to the right project.`);
95
+ }
96
+ else if (!error.originalError || Object.keys(error.originalError).length === 0) {
97
+ throw new Error(`Failed to ${context.operation} ${context.bucket}/${context.filePath} (supabase): ` +
98
+ 'Authentication error. Please check your SUPABASE_ANON_KEY is correct and not expired. ' +
99
+ 'Get a new one from Supabase Dashboard > Settings > API.');
100
+ }
101
+ }
102
+ // Handle Supabase StorageError with originalError
103
+ if (error.__isStorageError && error.originalError && error.originalError.status) {
104
+ return this.handleHttpError(error, context, error.originalError.status);
105
+ }
106
+ // Handle direct Supabase error messages
107
+ if (error.message) {
108
+ if (error.message.includes('Object not found')) {
109
+ context.operation = 'download';
110
+ return this.handleHttpError(error, context, 404);
111
+ }
112
+ if (error.message.includes('Bucket not found') || error.message.includes('The resource you requested could not be found')) {
113
+ throw new Error(`Failed to ${context.operation} ${context.bucket}/${context.filePath} (supabase): ` +
114
+ `Bucket '${context.bucket}' doesn't exist. Check: 1) bucket name is spelled correctly, ` +
115
+ `2) bucket exists in your Supabase project, 3) you're connected to the right project.`);
116
+ }
117
+ }
118
+ // Fallback to generic handling
119
+ return this.handleGenericError(error, context);
120
+ }
121
+ /**
122
+ * Handle AWS S3-specific error patterns
123
+ * TODO: Implement when S3 backend is added
124
+ */
125
+ static handleS3Error(error, context) {
126
+ // S3-specific error handling will go here
127
+ // e.g., NoSuchBucket, NoSuchKey, AccessDenied, etc.
128
+ return this.handleGenericError(error, context);
129
+ }
130
+ /**
131
+ * Handle Google Cloud Storage-specific error patterns
132
+ * TODO: Implement when GCS backend is added
133
+ */
134
+ static handleGCSError(error, context) {
135
+ // GCS-specific error handling will go here
136
+ return this.handleGenericError(error, context);
137
+ }
138
+ /**
139
+ * Generic error handling for unknown or unexpected errors
140
+ */
141
+ static handleGenericError(error, context) {
142
+ const { provider, operation, bucket, filePath } = context;
143
+ const resource = bucket && filePath ? `${bucket}/${filePath}` : bucket || filePath || 'resource';
144
+ // Handle SSL/certificate issues common in corporate environments
145
+ if (error.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' ||
146
+ error.code === 'CERT_UNTRUSTED' ||
147
+ error.code === 'SELF_SIGNED_CERT_IN_CHAIN' ||
148
+ error.message?.includes('certificate') ||
149
+ error.message?.includes('SSL') ||
150
+ error.message?.includes('TLS')) {
151
+ throw new Error(`SSL/Certificate error connecting to ${provider}: ${error.message}. ` +
152
+ `If you're on a corporate network, try: 1) disconnect/reconnect VPN, 2) check with IT about certificate issues, 3) try from a different network.`);
153
+ }
154
+ let errorMessage = `${provider} storage error while trying to ${operation} ${resource}`;
155
+ if (error.message) {
156
+ errorMessage += `: ${error.message}`;
157
+ }
158
+ else {
159
+ errorMessage += `: ${JSON.stringify(error)}`;
160
+ }
161
+ throw new Error(errorMessage);
162
+ }
163
+ /**
164
+ * Wrap async storage operations with consistent error handling
165
+ */
166
+ static async wrapStorageOperation(operation, context) {
167
+ try {
168
+ return await operation();
169
+ }
170
+ catch (error) {
171
+ this.handleProviderError(error, context);
172
+ }
173
+ }
174
+ }
175
+ exports.StorageErrorHandler = StorageErrorHandler;
176
+ //# sourceMappingURL=storage-error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-error-handler.js","sourceRoot":"","sources":["../../src/lib/storage-error-handler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,MAAa,mBAAmB;IAE9B;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,KAAU,EACV,OAA4B,EAC5B,UAAmB;QAEnB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAC1D,MAAM,QAAQ,GAAG,MAAM,IA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,KAAK,CAAC;YAC9B,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACb,uCAAuC,QAAQ,KAAK,KAAK,CAAC,OAAO,IAAI;gBACrE,iJAAiJ,CAClJ,CAAC;QACJ,CAAC;QAED,IAAI,YAAY,GAAG,GAAG,QAAQ,kCAAkC,SAAS,IAAI,QAAQ,EAAE,CAAC;QAExF,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,YAAY,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,YAAY,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAC/B,SAA2B,EAC3B,OAA4B;QAE5B,IAAI,CAAC;YACH,OAAO,MAAM,SAAS,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CACF;AArMD,kDAqMC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lettactl",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "kubectl-style CLI for managing Letta AI agent fleets",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -44,10 +44,13 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@letta-ai/letta-client": "^1.3.2",
47
+ "@supabase/supabase-js": "^2.86.2",
47
48
  "chalk": "^5.6.2",
48
49
  "cli-table3": "^0.6.5",
49
50
  "commander": "^14.0.2",
50
- "js-yaml": "^4.1.1"
51
+ "glob": "^13.0.0",
52
+ "js-yaml": "^4.1.1",
53
+ "ora": "^9.0.0"
51
54
  },
52
55
  "devDependencies": {
53
56
  "@types/jest": "^30.0.0",