atlas-pipeline-mcp 1.0.22 → 1.0.25

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 (50) hide show
  1. package/README.md +316 -49
  2. package/dist/common/error-handling.d.ts +86 -0
  3. package/dist/common/error-handling.d.ts.map +1 -0
  4. package/dist/common/error-handling.js +226 -0
  5. package/dist/common/error-handling.js.map +1 -0
  6. package/dist/mcp.js +50 -0
  7. package/dist/mcp.js.map +1 -1
  8. package/dist/tools/api-design-consultant.d.ts +92 -0
  9. package/dist/tools/api-design-consultant.d.ts.map +1 -0
  10. package/dist/tools/api-design-consultant.js +374 -0
  11. package/dist/tools/api-design-consultant.js.map +1 -0
  12. package/dist/tools/debug/error-classifier.d.ts +14 -0
  13. package/dist/tools/debug/error-classifier.d.ts.map +1 -0
  14. package/dist/tools/debug/error-classifier.js +40 -0
  15. package/dist/tools/debug/error-classifier.js.map +1 -0
  16. package/dist/tools/debug/language-detector.d.ts +16 -0
  17. package/dist/tools/debug/language-detector.d.ts.map +1 -0
  18. package/dist/tools/debug/language-detector.js +67 -0
  19. package/dist/tools/debug/language-detector.js.map +1 -0
  20. package/dist/tools/debug/stack-parser.d.ts +25 -0
  21. package/dist/tools/debug/stack-parser.d.ts.map +1 -0
  22. package/dist/tools/debug/stack-parser.js +122 -0
  23. package/dist/tools/debug/stack-parser.js.map +1 -0
  24. package/dist/tools/dependencies.d.ts.map +1 -1
  25. package/dist/tools/dependencies.js +50 -25
  26. package/dist/tools/dependencies.js.map +1 -1
  27. package/dist/tools/performance-optimizer.d.ts +97 -0
  28. package/dist/tools/performance-optimizer.d.ts.map +1 -0
  29. package/dist/tools/performance-optimizer.js +295 -0
  30. package/dist/tools/performance-optimizer.js.map +1 -0
  31. package/dist/tools/security-scanner.d.ts +74 -0
  32. package/dist/tools/security-scanner.d.ts.map +1 -0
  33. package/dist/tools/security-scanner.js +290 -0
  34. package/dist/tools/security-scanner.js.map +1 -0
  35. package/dist/tools/senior-mentor.d.ts +81 -0
  36. package/dist/tools/senior-mentor.d.ts.map +1 -0
  37. package/dist/tools/senior-mentor.js +308 -0
  38. package/dist/tools/senior-mentor.js.map +1 -0
  39. package/dist/tools/state-management-architect.d.ts +77 -0
  40. package/dist/tools/state-management-architect.d.ts.map +1 -0
  41. package/dist/tools/state-management-architect.js +323 -0
  42. package/dist/tools/state-management-architect.js.map +1 -0
  43. package/dist/tools/test-utils.d.ts.map +1 -1
  44. package/dist/tools/test-utils.js +109 -56
  45. package/dist/tools/test-utils.js.map +1 -1
  46. package/dist/tools/ui-ux-designer.d.ts +91 -0
  47. package/dist/tools/ui-ux-designer.d.ts.map +1 -0
  48. package/dist/tools/ui-ux-designer.js +907 -0
  49. package/dist/tools/ui-ux-designer.js.map +1 -0
  50. package/package.json +3 -2
package/README.md CHANGED
@@ -1,45 +1,162 @@
1
+ # Atlas MCP Server
1
2
 
2
- # Atlas MCP Server (`atlas-pipeline-mcp`)
3
+ <div align="center">
3
4
 
4
- **The Agentic AI Pipeline for your IDE.**
5
- Works natively with **Cursor**, **GitHub Copilot**, **Windsurf**, and **VS Code**.
5
+ [![npm version](https://img.shields.io/npm/v/atlas-pipeline-mcp.svg?style=flat-square&color=blue)](https://www.npmjs.com/package/atlas-pipeline-mcp)
6
+ [![npm downloads](https://img.shields.io/npm/dm/atlas-pipeline-mcp.svg?style=flat-square&color=green)](https://www.npmjs.com/package/atlas-pipeline-mcp)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
9
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-green?style=flat-square&logo=node.js)](https://nodejs.org/)
6
10
 
7
- Atlas is an MCP server that gives your IDE "Agentic Superpowers". Instead of just creating code, it enables a full analysis pipeline:
8
- **Intent → Context → Decomposition → Variants → Critique → Optimization**.
11
+ **The Agentic AI Pipeline for your IDE**
12
+
13
+ Advanced AI/ML-powered development tools with RAG search, ML bug prediction, intelligent code migration, and comprehensive test generation.
14
+
15
+ [Installation](#installation-1-click-setup) • [Features](#key-features) • [Tools](#all-available-tools-17-total) • [Usage](#how-to-use-cheat-sheet) • [Documentation](#advanced-integration-optional)
16
+
17
+ </div>
9
18
 
10
19
  ---
11
20
 
12
- ## 🚀 What's New in v1.0.19
21
+ ## Overview
13
22
 
14
- **Performance Optimizations:**
15
- - ⚡ **LRU Cache** - Intelligent caching for LLM responses and pipeline results
16
- - 🔄 **Request Deduplication** - Prevents duplicate concurrent API calls
17
- - 📊 **Metrics Collection** - Built-in performance monitoring with P50/P95/P99 stats
18
- - 🔒 **Circuit Breaker** - Resilient provider connections with automatic recovery
19
- - 🧹 **Session Management** - Automatic cleanup of stale thinking sessions
20
- - 🚀 **Parallel Execution** - Independent pipeline stages run concurrently
23
+ Atlas MCP Server gives your IDE "Agentic Superpowers" through a full analysis pipeline:
21
24
 
22
- **All 15 Powerful Tools:**
23
- - 🔒 **atlas_security** - Scan code for vulnerabilities (SQL injection, XSS, secrets, etc.)
24
- - 🧪 **atlas_test** - Auto-generate comprehensive test cases
25
- - 📚 **atlas_docs** - Generate documentation (JSDoc, TSDoc, PyDoc)
26
- - 💡 **atlas_explain** - Explain code with complexity analysis & design patterns
27
- - 🐛 **atlas_debug** - Debug errors with root cause analysis & fix suggestions
28
- - 🧠 **atlas_think** - Advanced sequential reasoning with branching & verification
25
+ **Intent Context → Decomposition → Variants → Critique → Optimization**
26
+
27
+ Works natively with **Cursor**, **Windsurf**, **Claude Desktop**, **GitHub Copilot**, and **VS Code**.
29
28
 
30
29
  ---
31
30
 
32
- ## Key Features
31
+ ---
33
32
 
34
- - **Zero Config**: No API keys required. It uses your IDE's built-in AI (Copilot/Cursor) for analysis.
35
- - **Agentic Workflow**: Breaks down specific tasks into a DAG (Directed Acyclic Graph) of subtasks.
36
- - **Optimization Loop**: Generates variants, critiques them, and produces a final optimized solution.
37
- - **Context Aware**: Deeply analyzes project structure, file dependencies, and git history.
38
- - **Security Scanner**: Detects vulnerabilities with CWE IDs and OWASP categories.
39
- - **Test Generator**: Creates unit/integration tests for Jest, Vitest, Pytest, Mocha.
40
- - **Smart Debugging**: Analyzes errors, parses stack traces, suggests fixes.
41
- - **Sequential Thinking**: Advanced reasoning with branching, revision, and hypothesis verification.
42
- - **High Performance**: LRU caching, request deduplication, and parallel execution.
33
+ ## What's New in v1.0.25
34
+
35
+ ### 🌟 5 Advanced Senior Developer Tools (NEW!)
36
+
37
+ These tools help frontend developers think like senior engineers with AI-powered guidance:
38
+
39
+ <table>
40
+ <tr>
41
+ <td width="25%"><b>🧠 Senior Mentor</b></td>
42
+ <td>Architectural guidance from a 15+ year veteran perspective with trade-off analysis and senior lessons</td>
43
+ </tr>
44
+ <tr>
45
+ <td><b>⚡ Performance Optimizer</b></td>
46
+ <td>Deep performance analysis with Web Vitals optimization and bottleneck detection</td>
47
+ </tr>
48
+ <tr>
49
+ <td><b>🔒 Security Scanner</b></td>
50
+ <td>Enterprise-grade vulnerability detection with compliance assessment (GDPR, CCPA, HIPAA, PCI-DSS)</td>
51
+ </tr>
52
+ <tr>
53
+ <td><b>📦 State Management Architect</b></td>
54
+ <td>Pattern comparison and scalability analysis for Redux, Zustand, Jotai, Recoil, and more</td>
55
+ </tr>
56
+ <tr>
57
+ <td><b>🏗️ API Design Consultant</b></td>
58
+ <td>RESTful and GraphQL API design review with best practices and documentation templates</td>
59
+ </tr>
60
+ </table>
61
+
62
+ ### Previous Releases (v1.0.23)
63
+
64
+ #### Advanced AI/ML Tools (4)
65
+
66
+ <table>
67
+ <tr>
68
+ <td width="25%"><b>RAG Search</b></td>
69
+ <td>Semantic code search with knowledge graphs and natural language queries</td>
70
+ </tr>
71
+ <tr>
72
+ <td><b>ML Predictor</b></td>
73
+ <td>Bug & performance prediction with 70-85% accuracy using machine learning</td>
74
+ </tr>
75
+ <tr>
76
+ <td><b>Code Migration</b></td>
77
+ <td>Intelligent migration (12 types: JS→TS, React upgrades, Callbacks→Async)</td>
78
+ </tr>
79
+ <tr>
80
+ <td><b>Test Generator</b></td>
81
+ <td>Advanced test generation with edge cases, mocks, and property-based testing</td>
82
+ </tr>
83
+ </table>
84
+
85
+ ### Core Professional Tools (13)
86
+
87
+ <table>
88
+ <tr>
89
+ <td width="25%"><b>Refactor</b></td>
90
+ <td>Code refactoring engine with complexity analysis</td>
91
+ </tr>
92
+ <tr>
93
+ <td><b>Profiler</b></td>
94
+ <td>Performance profiling & bottleneck detection (O(n), O(n²), etc.)</td>
95
+ </tr>
96
+ <tr>
97
+ <td><b>Review</b></td>
98
+ <td>Automated code review with quality scores and security checks</td>
99
+ </tr>
100
+ <tr>
101
+ <td><b>Dependencies</b></td>
102
+ <td>Dependency analysis, unused package detection, vulnerability scanning</td>
103
+ </tr>
104
+ <tr>
105
+ <td><b>Dashboard</b></td>
106
+ <td>Interactive HTML metrics dashboards with real-time data</td>
107
+ </tr>
108
+ <tr>
109
+ <td><b>Security</b></td>
110
+ <td>Security vulnerability scanning (CWE, OWASP standards)</td>
111
+ </tr>
112
+ <tr>
113
+ <td><b>Test Gen</b></td>
114
+ <td>Comprehensive test case generation (Jest, Vitest, Pytest, Mocha)</td>
115
+ </tr>
116
+ <tr>
117
+ <td><b>Docs Gen</b></td>
118
+ <td>Auto-generate documentation (JSDoc, TSDoc, PyDoc)</td>
119
+ </tr>
120
+ </table>
121
+
122
+ ---
123
+
124
+ ## ✨ What's New in v1.0.23
125
+
126
+ ---
127
+
128
+ ## 🎯 Key Features
129
+
130
+ <table>
131
+ <tr>
132
+ <td width="50%" valign="top">
133
+
134
+ ### 🤖 AI/ML Capabilities
135
+ - **RAG Search** - Semantic code understanding with knowledge graphs
136
+ - **ML Prediction** - Bug & performance forecasting (70-85% accuracy)
137
+ - **Code Migration** - 12 intelligent migration types
138
+ - **Test Generation** - Advanced test suites with edge cases
139
+
140
+ </td>
141
+ <td width="50%" valign="top">
142
+
143
+ ### ⚡ Professional Tools
144
+ - **Full Pipeline** - Intent → Context → Variants → Optimize
145
+ - **Quality Analysis** - Code review, security, complexity
146
+ - **Performance** - Profiling, bottleneck detection
147
+ - **Automation** - Tests, docs, refactoring
148
+
149
+ </td>
150
+ </tr>
151
+ </table>
152
+
153
+ ### 🌟 Why Atlas?
154
+
155
+ - **Zero Config**: No API keys required - uses your IDE's built-in AI (Copilot/Cursor)
156
+ - **23 Professional Tools**: 13 core + 4 advanced AI/ML + 5 senior developer + 1 UI/UX designer
157
+ - **Agentic Workflow**: DAG-based task decomposition
158
+ - **Context Aware**: Project structure, dependencies, git history analysis
159
+ - **High Performance**: LRU caching, request deduplication, parallel execution
43
160
 
44
161
  ---
45
162
 
@@ -64,25 +181,162 @@ Restart your editor. You should see the Atlas server connected in your MCP setti
64
181
 
65
182
  ---
66
183
 
67
- ## All Available Tools (15 Total)
68
-
69
- | Tool | Description |
70
- | :--- | :--- |
71
- | `atlas_pipeline` | Full agentic pipeline: Intent → Context → Decompose → Variants → Critique → Optimize |
72
- | `atlas_intent` | Analyze user intent from natural language |
73
- | `atlas_context` | Gather project context, dependencies, and structure |
74
- | `atlas_git` | Analyze Git history, branches, and file changes |
75
- | `atlas_decompose` | Break down complex tasks into subtasks (DAG) |
76
- | `atlas_variants` | Generate multiple solution approaches |
77
- | `atlas_critique` | Review code for quality, security, best practices |
78
- | `atlas_optimize` | Optimize code based on feedback |
79
- | `atlas_security` | Scan for security vulnerabilities (CWE, OWASP) |
80
- | `atlas_test` | Generate comprehensive test cases |
81
- | `atlas_docs` | Generate documentation (JSDoc/TSDoc/PyDoc) |
82
- | `atlas_explain` | Explain code with complexity & pattern analysis |
83
- | `atlas_debug` | Debug errors with root cause analysis |
84
- | `atlas_think` | Advanced sequential reasoning with branching |
85
- | `atlas_providers` | Check LLM provider status |
184
+ ## 🛠️ All Available Tools (23 Total)
185
+
186
+ ### 🔥 Advanced AI/ML Tools
187
+
188
+ <table>
189
+ <tr>
190
+ <td width="30%"><code>atlas_rag_search</code></td>
191
+ <td><b>RAG-Powered Semantic Search</b><br/>Natural language code search with knowledge graphs. Ask "how does auth work?" and get contextual results.</td>
192
+ </tr>
193
+ <tr>
194
+ <td><code>atlas_ml_predict</code></td>
195
+ <td><b>ML Bug & Performance Prediction</b><br/>Predict bugs before production with 70-85% accuracy. Analyzes complexity, churn, and code patterns.</td>
196
+ </tr>
197
+ <tr>
198
+ <td><code>atlas_migrate</code></td>
199
+ <td><b>Intelligent Code Migration</b><br/>Automated migration support for 12 types: JS→TS, React upgrades, Callbacks→Async, and more.</td>
200
+ </tr>
201
+ <tr>
202
+ <td><code>atlas_testgen_advanced</code></td>
203
+ <td><b>Advanced Test Generation</b><br/>Generate comprehensive test suites with edge cases, mocks, stubs, and 90%+ coverage projection.</td>
204
+ </tr>
205
+ </table>
206
+
207
+ ### ⚡ Core Pipeline & Analysis Tools
208
+
209
+ <table>
210
+ <tr>
211
+ <td width="30%"><code>atlas_pipeline</code></td>
212
+ <td><b>Full Agentic Pipeline</b><br/>Complete workflow: Intent → Context → Decompose → Variants → Critique → Optimize</td>
213
+ </tr>
214
+ <tr>
215
+ <td><code>atlas_intent</code></td>
216
+ <td><b>Intent Analysis</b><br/>Extract actionable intent from natural language requests</td>
217
+ </tr>
218
+ <tr>
219
+ <td><code>atlas_context</code></td>
220
+ <td><b>Project Context Gathering</b><br/>Analyze project structure, dependencies, and file relationships</td>
221
+ </tr>
222
+ <tr>
223
+ <td><code>atlas_git</code></td>
224
+ <td><b>Git History Analysis</b><br/>Analyze commits, branches, file changes, and code evolution</td>
225
+ </tr>
226
+ <tr>
227
+ <td><code>atlas_decompose</code></td>
228
+ <td><b>Task Decomposition</b><br/>Break complex tasks into DAG (Directed Acyclic Graph) of subtasks</td>
229
+ </tr>
230
+ <tr>
231
+ <td><code>atlas_variants</code></td>
232
+ <td><b>Solution Variants</b><br/>Generate multiple implementation approaches with pros/cons analysis</td>
233
+ </tr>
234
+ </table>
235
+
236
+ ### 🎯 Quality & Optimization Tools
237
+
238
+ <table>
239
+ <tr>
240
+ <td width="30%"><code>atlas_review</code></td>
241
+ <td><b>Automated Code Review</b><br/>Comprehensive analysis with quality scores, security checks, and best practice validation</td>
242
+ </tr>
243
+ <tr>
244
+ <td><code>atlas_critique</code></td>
245
+ <td><b>Code Critique</b><br/>Deep review for quality, security, performance, and maintainability</td>
246
+ </tr>
247
+ <tr>
248
+ <td><code>atlas_optimize</code></td>
249
+ <td><b>Code Optimization</b><br/>Apply improvements based on critique feedback and best practices</td>
250
+ </tr>
251
+ <tr>
252
+ <td><code>atlas_refactor</code></td>
253
+ <td><b>Smart Refactoring</b><br/>Code restructuring with complexity metrics and structural analysis</td>
254
+ </tr>
255
+ <tr>
256
+ <td><code>atlas_security</code></td>
257
+ <td><b>Security Scanner</b><br/>Detect vulnerabilities with CWE IDs and OWASP category mapping</td>
258
+ </tr>
259
+ </table>
260
+
261
+ ### 🧠 Advanced Senior Developer Tools (NEW!)
262
+
263
+ <table>
264
+ <tr>
265
+ <td width="30%"><code>atlas_senior_mentor</code></td>
266
+ <td><b>Senior Mentor</b><br/>Architectural guidance from 15+ year veteran perspective with trade-off analysis and senior lessons</td>
267
+ </tr>
268
+ <tr>
269
+ <td><code>atlas_performance_optimizer</code></td>
270
+ <td><b>Performance Optimizer</b><br/>Deep performance analysis with Web Vitals optimization and bottleneck detection</td>
271
+ </tr>
272
+ <tr>
273
+ <td><code>atlas_security_scanner</code></td>
274
+ <td><b>Security Scanner Pro</b><br/>Enterprise-grade vulnerability detection with compliance assessment (GDPR, CCPA, HIPAA, PCI-DSS)</td>
275
+ </tr>
276
+ <tr>
277
+ <td><code>atlas_state_architect</code></td>
278
+ <td><b>State Management Architect</b><br/>Pattern comparison and scalability analysis for Redux, Zustand, Jotai, Recoil</td>
279
+ </tr>
280
+ <tr>
281
+ <td><code>atlas_api_consultant</code></td>
282
+ <td><b>API Design Consultant</b><br/>RESTful and GraphQL API design review with best practices and documentation templates</td>
283
+ </tr>
284
+ </table>
285
+
286
+ ### 🎨 Design & UI/UX Tools
287
+
288
+ <table>
289
+ <tr>
290
+ <td width="30%"><code>atlas_ui_ux_designer</code></td>
291
+ <td><b>UI/UX Designer</b><br/>Find best design inspirations online, generate multiple design options with images, and create production-ready code. Supports React, Vue, HTML, Svelte with accessibility guidance.</td>
292
+ </tr>
293
+ </table>
294
+
295
+ ### 🚀 Development Productivity Tools
296
+
297
+ <table>
298
+ <tr>
299
+ <td width="30%"><code>atlas_profiler</code></td>
300
+ <td><b>Performance Profiling</b><br/>Detect bottlenecks, analyze time complexity (O(n), O(n²)), and memory usage</td>
301
+ </tr>
302
+ <tr>
303
+ <td><code>atlas_test</code></td>
304
+ <td><b>Test Case Generation</b><br/>Generate comprehensive tests for Jest, Vitest, Pytest, Mocha</td>
305
+ </tr>
306
+ <tr>
307
+ <td><code>atlas_docs</code></td>
308
+ <td><b>Auto Documentation</b><br/>Generate JSDoc, TSDoc, or PyDoc documentation automatically</td>
309
+ </tr>
310
+ <tr>
311
+ <td><code>atlas_dependencies</code></td>
312
+ <td><b>Dependency Analysis</b><br/>Detect unused packages, analyze dependencies, scan for vulnerabilities</td>
313
+ </tr>
314
+ <tr>
315
+ <td><code>atlas_dashboard</code></td>
316
+ <td><b>Metrics Dashboard</b><br/>Generate interactive HTML dashboards with real-time metrics</td>
317
+ </tr>
318
+ <tr>
319
+ <td><code>atlas_explain</code></td>
320
+ <td><b>Code Explanation</b><br/>Explain code with complexity analysis and pattern detection</td>
321
+ </tr>
322
+ <tr>
323
+ <td><code>atlas_debug</code></td>
324
+ <td><b>Smart Debugging</b><br/>Root cause analysis, stack trace parsing, and fix suggestions</td>
325
+ </tr>
326
+ <tr>
327
+ <td><code>atlas_think</code></td>
328
+ <td><b>Advanced Reasoning</b><br/>Sequential reasoning with branching logic for complex problems</td>
329
+ </tr>
330
+ </table>
331
+
332
+ ### 🔧 Utility Tools
333
+
334
+ <table>
335
+ <tr>
336
+ <td width="30%"><code>atlas_providers</code></td>
337
+ <td><b>Provider Status</b><br/>Check available LLM providers and their current status</td>
338
+ </tr>
339
+ </table>
86
340
 
87
341
  ---
88
342
 
@@ -90,9 +344,22 @@ Restart your editor. You should see the Atlas server connected in your MCP setti
90
344
 
91
345
  Once installed, simply chat with your AI Assistant (Copilot Chat or Cursor Chat). The server automatically activates based on your intent.
92
346
 
347
+ ### Advanced AI/ML Tools
348
+ | Goal | What to Ask | Tool Used |
349
+ | :--- | :--- | :--- |
350
+ | **Semantic Code Search** | "Search for authentication code using RAG" | `atlas_rag_search` |
351
+ | **Predict Bugs** | "Predict bug probability in payment-processor.ts" | `atlas_ml_predict` |
352
+ | **Migrate Codebase** | "Migrate this file from JavaScript to TypeScript" | `atlas_migrate` |
353
+ | **Advanced Testing** | "Generate comprehensive tests with edge cases" | `atlas_testgen_advanced` |
354
+
355
+ ### Professional Development Tools
93
356
  | Goal | What to Ask | Tool Used |
94
357
  | :--- | :--- | :--- |
95
358
  | **Fix a complex file** | "Run the **pipeline** on `utils.ts` to refactor it." | `atlas_pipeline` |
359
+ | **Refactor Code** | "Refactor this code and reduce complexity" | `atlas_refactor` |
360
+ | **Performance Analysis** | "Profile this code for performance bottlenecks" | `atlas_profiler` |
361
+ | **Code Review** | "Review this PR for quality and security" | `atlas_review` |
362
+ | **Check Dependencies** | "Analyze dependencies and find unused packages" | `atlas_dependencies` |
96
363
  | **Plan a feature** | "**Decompose** the task of adding JWT auth." | `atlas_decompose` |
97
364
  | **Explore ideas** | "Generate **3 variants** for this button component." | `atlas_variants` |
98
365
  | **Review Code** | "**Critique** this code for security issues." | `atlas_critique` |
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Common Error Handling and Validation Utilities
3
+ * Centralized error handling to improve reliability across all tools
4
+ */
5
+ import { z } from 'zod';
6
+ export declare class ValidationError extends Error {
7
+ readonly field?: string | undefined;
8
+ constructor(message: string, field?: string | undefined);
9
+ }
10
+ export declare class FileSystemError extends Error {
11
+ readonly path?: string | undefined;
12
+ constructor(message: string, path?: string | undefined);
13
+ }
14
+ export declare class LLMProviderError extends Error {
15
+ readonly provider?: string | undefined;
16
+ constructor(message: string, provider?: string | undefined);
17
+ }
18
+ export declare class TimeoutError extends Error {
19
+ readonly timeoutMs?: number | undefined;
20
+ constructor(message: string, timeoutMs?: number | undefined);
21
+ }
22
+ /**
23
+ * Validate and parse input with Zod schema
24
+ */
25
+ export declare function validateInput<T>(schema: z.ZodSchema<T>, data: unknown, errorMessage?: string): T;
26
+ /**
27
+ * Safely validate file path exists and is accessible
28
+ */
29
+ export declare function validatePath(path: string, type?: 'file' | 'directory'): Promise<void>;
30
+ /**
31
+ * Validate required fields are present
32
+ */
33
+ export declare function requireFields<T extends Record<string, unknown>>(obj: T, fields: (keyof T)[]): void;
34
+ /**
35
+ * Wrap async function with error handling and logging
36
+ */
37
+ export declare function withErrorHandling<T extends (...args: any[]) => Promise<any>>(fn: T, errorMessage?: string): T;
38
+ /**
39
+ * Retry async operation with exponential backoff
40
+ */
41
+ export declare function withRetry<T>(fn: () => Promise<T>, options?: {
42
+ maxAttempts?: number;
43
+ delayMs?: number;
44
+ backoffMultiplier?: number;
45
+ onRetry?: (attempt: number, error: Error) => void;
46
+ }): Promise<T>;
47
+ /**
48
+ * Add timeout to async operation
49
+ */
50
+ export declare function withTimeout<T>(fn: () => Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;
51
+ /**
52
+ * Safe JSON parse with error handling
53
+ */
54
+ export declare function safeJsonParse<T = unknown>(json: string, defaultValue?: T): T | undefined;
55
+ /**
56
+ * Safe async operation with fallback
57
+ */
58
+ export declare function safeAsync<T>(fn: () => Promise<T>, fallback: T): Promise<T>;
59
+ /**
60
+ * Sanitize user input to prevent injection attacks
61
+ */
62
+ export declare function sanitizeInput(input: string): string;
63
+ /**
64
+ * Validate and sanitize file path
65
+ */
66
+ export declare function sanitizePath(path: string): string;
67
+ export type Result<T, E = Error> = {
68
+ success: true;
69
+ data: T;
70
+ } | {
71
+ success: false;
72
+ error: E;
73
+ };
74
+ /**
75
+ * Create success result
76
+ */
77
+ export declare function success<T>(data: T): Result<T, never>;
78
+ /**
79
+ * Create error result
80
+ */
81
+ export declare function failure<E = Error>(error: E): Result<never, E>;
82
+ /**
83
+ * Wrap function to return Result type
84
+ */
85
+ export declare function tryAsync<T>(fn: () => Promise<T>): Promise<Result<T>>;
86
+ //# sourceMappingURL=error-handling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/common/error-handling.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,qBAAa,eAAgB,SAAQ,KAAK;aACK,KAAK,CAAC,EAAE,MAAM;gBAA/C,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,MAAM,YAAA;CAI5D;AAED,qBAAa,eAAgB,SAAQ,KAAK;aACK,IAAI,CAAC,EAAE,MAAM;gBAA9C,OAAO,EAAE,MAAM,EAAkB,IAAI,CAAC,EAAE,MAAM,YAAA;CAI3D;AAED,qBAAa,gBAAiB,SAAQ,KAAK;aACI,QAAQ,CAAC,EAAE,MAAM;gBAAlD,OAAO,EAAE,MAAM,EAAkB,QAAQ,CAAC,EAAE,MAAM,YAAA;CAI/D;AAED,qBAAa,YAAa,SAAQ,KAAK;aACQ,SAAS,CAAC,EAAE,MAAM;gBAAnD,OAAO,EAAE,MAAM,EAAkB,SAAS,CAAC,EAAE,MAAM,YAAA;CAIhE;AAMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACtB,IAAI,EAAE,OAAO,EACb,YAAY,CAAC,EAAE,MAAM,GACpB,CAAC,CAYH;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,GAAG,WAAoB,GAAG,OAAO,CAAC,IA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