@notjustcoders/ioc-arise 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/analyser/ast-parser.d.ts +3 -0
  2. package/dist/analyser/ast-parser.d.ts.map +1 -1
  3. package/dist/analyser/ast-parser.js +42 -4
  4. package/dist/analyser/ast-parser.js.map +1 -1
  5. package/dist/analyser/ast-parser.test.d.ts +2 -0
  6. package/dist/analyser/ast-parser.test.d.ts.map +1 -0
  7. package/dist/analyser/ast-parser.test.js +319 -0
  8. package/dist/analyser/ast-parser.test.js.map +1 -0
  9. package/dist/analyser/class-analyzer.d.ts +1 -1
  10. package/dist/analyser/class-analyzer.d.ts.map +1 -1
  11. package/dist/analyser/class-analyzer.js +70 -12
  12. package/dist/analyser/class-analyzer.js.map +1 -1
  13. package/dist/analyser/project-analyzer.d.ts.map +1 -1
  14. package/dist/analyser/project-analyzer.js +11 -4
  15. package/dist/analyser/project-analyzer.js.map +1 -1
  16. package/dist/commands/analyze.d.ts.map +1 -1
  17. package/dist/commands/analyze.js +35 -10
  18. package/dist/commands/analyze.js.map +1 -1
  19. package/dist/commands/generate.d.ts.map +1 -1
  20. package/dist/commands/generate.js +39 -24
  21. package/dist/commands/generate.js.map +1 -1
  22. package/dist/commands/visualize.d.ts.map +1 -1
  23. package/dist/commands/visualize.js +30 -5
  24. package/dist/commands/visualize.js.map +1 -1
  25. package/dist/debug-test.d.ts +2 -0
  26. package/dist/debug-test.d.ts.map +1 -0
  27. package/dist/debug-test.js +37 -0
  28. package/dist/debug-test.js.map +1 -0
  29. package/dist/errors/IoCError.d.ts +107 -0
  30. package/dist/errors/IoCError.d.ts.map +1 -0
  31. package/dist/errors/IoCError.js +177 -0
  32. package/dist/errors/IoCError.js.map +1 -0
  33. package/dist/errors/errorFactory.d.ts +33 -0
  34. package/dist/errors/errorFactory.d.ts.map +1 -0
  35. package/dist/errors/errorFactory.js +166 -0
  36. package/dist/errors/errorFactory.js.map +1 -0
  37. package/dist/errors/index.d.ts +44 -0
  38. package/dist/errors/index.d.ts.map +1 -0
  39. package/dist/errors/index.js +80 -0
  40. package/dist/errors/index.js.map +1 -0
  41. package/dist/generator/file-writer.d.ts.map +1 -1
  42. package/dist/generator/file-writer.js +11 -5
  43. package/dist/generator/file-writer.js.map +1 -1
  44. package/dist/generator/modular/modular-container-generator.d.ts.map +1 -1
  45. package/dist/generator/modular/modular-container-generator.js +11 -2
  46. package/dist/generator/modular/modular-container-generator.js.map +1 -1
  47. package/dist/generator/modular/split-file-writer.d.ts +4 -4
  48. package/dist/generator/modular/split-file-writer.d.ts.map +1 -1
  49. package/dist/generator/modular/split-file-writer.js +15 -4
  50. package/dist/generator/modular/split-file-writer.js.map +1 -1
  51. package/dist/types.d.ts +2 -0
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/utils/configManager.d.ts.map +1 -1
  54. package/dist/utils/configManager.js +10 -2
  55. package/dist/utils/configManager.js.map +1 -1
  56. package/dist/utils/configValidator.d.ts +30 -0
  57. package/dist/utils/configValidator.d.ts.map +1 -0
  58. package/dist/utils/configValidator.js +125 -0
  59. package/dist/utils/configValidator.js.map +1 -0
  60. package/dist/utils/moduleResolver.d.ts +2 -1
  61. package/dist/utils/moduleResolver.d.ts.map +1 -1
  62. package/dist/utils/moduleResolver.js +5 -4
  63. package/dist/utils/moduleResolver.js.map +1 -1
  64. package/package.json +3 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-test.d.ts","sourceRoot":"","sources":["../src/debug-test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const napi_1 = require("@ast-grep/napi");
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const filePath = path_1.default.join(__dirname, '../examples/abstract-classes-example/abstracts/AbstractRepository.ts');
10
+ const sourceCode = fs_1.default.readFileSync(filePath, 'utf8');
11
+ const root = napi_1.ts.parse(sourceCode);
12
+ console.log('Source code:');
13
+ console.log(sourceCode);
14
+ console.log('\nAST root:');
15
+ console.log(root.toString());
16
+ // Find class declarations
17
+ const classNodes = root.findAll({
18
+ rule: {
19
+ kind: 'class_declaration'
20
+ }
21
+ });
22
+ console.log('\nClass declarations found:', classNodes.length);
23
+ classNodes.forEach((node, index) => {
24
+ console.log(`Class ${index + 1}:`, node.text());
25
+ console.log(`Class ${index + 1} AST:`, node.toString());
26
+ });
27
+ // Also try to find export declarations
28
+ const exportNodes = root.findAll({
29
+ rule: {
30
+ kind: 'export_statement'
31
+ }
32
+ });
33
+ console.log('\nExport statements found:', exportNodes.length);
34
+ exportNodes.forEach((node, index) => {
35
+ console.log(`Export ${index + 1}:`, node.text());
36
+ });
37
+ //# sourceMappingURL=debug-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-test.js","sourceRoot":"","sources":["../src/debug-test.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sEAAsE,CAAC,CAAC;AAC9G,MAAM,UAAU,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACrD,MAAM,IAAI,GAAG,SAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAElC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACxB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE7B,0BAA0B;AAC1B,MAAM,UAAU,GAAI,IAAY,CAAC,OAAO,CAAC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,mBAAmB;KAC1B;CACF,CAAC,CAAC;AACH,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AAC9D,UAAU,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,KAAa,EAAE,EAAE;IAC9C,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEH,uCAAuC;AACvC,MAAM,WAAW,GAAI,IAAY,CAAC,OAAO,CAAC;IACxC,IAAI,EAAE;QACJ,IAAI,EAAE,kBAAkB;KACzB;CACF,CAAC,CAAC;AACH,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;AAC9D,WAAW,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,KAAa,EAAE,EAAE;IAC/C,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Error codes for IoC Arise CLI
3
+ */
4
+ export declare enum IoCErrorCode {
5
+ CONFIG_INVALID = "IOC_1000",
6
+ CONFIG_FILE_NOT_FOUND = "IOC_1001",
7
+ CONFIG_PARSE_ERROR = "IOC_1002",
8
+ CONFIG_VALIDATION_ERROR = "IOC_1003",
9
+ SOURCE_DIR_NOT_FOUND = "IOC_1100",
10
+ SOURCE_DIR_NOT_ACCESSIBLE = "IOC_1101",
11
+ SOURCE_DIR_EMPTY = "IOC_1102",
12
+ ANALYSIS_FAILED = "IOC_1200",
13
+ NO_CLASSES_FOUND = "IOC_1201",
14
+ CIRCULAR_DEPENDENCY = "IOC_1202",
15
+ DUPLICATE_INTERFACE_IMPLEMENTATION = "IOC_1203",
16
+ INVALID_INTERFACE_PATTERN = "IOC_1204",
17
+ GENERATION_FAILED = "IOC_1300",
18
+ OUTPUT_FILE_ERROR = "IOC_1301",
19
+ TEMPLATE_ERROR = "IOC_1302",
20
+ MODULE_CONFIG_INVALID = "IOC_1400",
21
+ MODULE_PATTERN_INVALID = "IOC_1401",
22
+ MODULE_DUPLICATE_PATTERN = "IOC_1402",
23
+ FILE_NOT_FOUND = "IOC_1500",
24
+ FILE_READ_ERROR = "IOC_1501",
25
+ FILE_WRITE_ERROR = "IOC_1502",
26
+ PERMISSION_DENIED = "IOC_1503",
27
+ VALIDATION_ERROR = "IOC_1600",
28
+ SCHEMA_VALIDATION_ERROR = "IOC_1601",
29
+ TYPE_VALIDATION_ERROR = "IOC_1602",
30
+ RUNTIME_ERROR = "IOC_1700",
31
+ UNEXPECTED_ERROR = "IOC_1701",
32
+ INITIALIZATION_ERROR = "IOC_1702",
33
+ RENDERER_NOT_FOUND = "IOC_1800",
34
+ RENDERER_ERROR = "IOC_1801"
35
+ }
36
+ /**
37
+ * Severity levels for errors
38
+ */
39
+ export declare enum ErrorSeverity {
40
+ LOW = "low",
41
+ MEDIUM = "medium",
42
+ HIGH = "high",
43
+ CRITICAL = "critical"
44
+ }
45
+ /**
46
+ * Additional context for errors
47
+ */
48
+ export interface ErrorContext {
49
+ filePath?: string;
50
+ lineNumber?: number;
51
+ columnNumber?: number;
52
+ className?: string;
53
+ interfaceName?: string;
54
+ moduleName?: string;
55
+ configProperty?: string;
56
+ [key: string]: any;
57
+ }
58
+ /**
59
+ * Base IoC error class with custom error codes
60
+ */
61
+ export declare class IoCError extends Error {
62
+ readonly code: IoCErrorCode;
63
+ readonly severity: ErrorSeverity;
64
+ readonly context?: ErrorContext;
65
+ readonly timestamp: Date;
66
+ readonly suggestions?: string[];
67
+ constructor(code: IoCErrorCode, message: string, severity?: ErrorSeverity, context?: ErrorContext, suggestions?: string[]);
68
+ /**
69
+ * Get a formatted error message with code and context
70
+ */
71
+ getFormattedMessage(): string;
72
+ /**
73
+ * Convert error to JSON for logging or API responses
74
+ */
75
+ toJSON(): object;
76
+ }
77
+ /**
78
+ * Configuration-specific error
79
+ */
80
+ export declare class ConfigError extends IoCError {
81
+ constructor(code: IoCErrorCode, message: string, context?: ErrorContext, suggestions?: string[]);
82
+ }
83
+ /**
84
+ * Analysis-specific error
85
+ */
86
+ export declare class AnalysisError extends IoCError {
87
+ constructor(code: IoCErrorCode, message: string, context?: ErrorContext, suggestions?: string[]);
88
+ }
89
+ /**
90
+ * Generation-specific error
91
+ */
92
+ export declare class GenerationError extends IoCError {
93
+ constructor(code: IoCErrorCode, message: string, context?: ErrorContext, suggestions?: string[]);
94
+ }
95
+ /**
96
+ * Validation-specific error
97
+ */
98
+ export declare class ValidationError extends IoCError {
99
+ constructor(code: IoCErrorCode, message: string, context?: ErrorContext, suggestions?: string[]);
100
+ }
101
+ /**
102
+ * File system-specific error
103
+ */
104
+ export declare class FileSystemError extends IoCError {
105
+ constructor(code: IoCErrorCode, message: string, context?: ErrorContext, suggestions?: string[]);
106
+ }
107
+ //# sourceMappingURL=IoCError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IoCError.d.ts","sourceRoot":"","sources":["../../src/errors/IoCError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,aAAa;IAC3B,qBAAqB,aAAa;IAClC,kBAAkB,aAAa;IAC/B,uBAAuB,aAAa;IAGpC,oBAAoB,aAAa;IACjC,yBAAyB,aAAa;IACtC,gBAAgB,aAAa;IAG7B,eAAe,aAAa;IAC5B,gBAAgB,aAAa;IAC7B,mBAAmB,aAAa;IAChC,kCAAkC,aAAa;IAC/C,yBAAyB,aAAa;IAGtC,iBAAiB,aAAa;IAC9B,iBAAiB,aAAa;IAC9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G;IACI,MAAM,IAAI,MAAM;CAYxB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,QAAQ;gBAErC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EACtB,WAAW,CAAC,EAAE,MAAM,EAAE;CAKzB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAEvC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EACtB,WAAW,CAAC,EAAE,MAAM,EAAE;CAKzB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;gBAEzC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EACtB,WAAW,CAAC,EAAE,MAAM,EAAE;CAKzB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;gBAEzC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EACtB,WAAW,CAAC,EAAE,MAAM,EAAE;CAKzB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;gBAEzC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EACtB,WAAW,CAAC,EAAE,MAAM,EAAE;CAKzB"}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileSystemError = exports.ValidationError = exports.GenerationError = exports.AnalysisError = exports.ConfigError = exports.IoCError = exports.ErrorSeverity = exports.IoCErrorCode = void 0;
4
+ /**
5
+ * Error codes for IoC Arise CLI
6
+ */
7
+ var IoCErrorCode;
8
+ (function (IoCErrorCode) {
9
+ // Configuration errors (1000-1099)
10
+ IoCErrorCode["CONFIG_INVALID"] = "IOC_1000";
11
+ IoCErrorCode["CONFIG_FILE_NOT_FOUND"] = "IOC_1001";
12
+ IoCErrorCode["CONFIG_PARSE_ERROR"] = "IOC_1002";
13
+ IoCErrorCode["CONFIG_VALIDATION_ERROR"] = "IOC_1003";
14
+ // Source directory errors (1100-1199)
15
+ IoCErrorCode["SOURCE_DIR_NOT_FOUND"] = "IOC_1100";
16
+ IoCErrorCode["SOURCE_DIR_NOT_ACCESSIBLE"] = "IOC_1101";
17
+ IoCErrorCode["SOURCE_DIR_EMPTY"] = "IOC_1102";
18
+ // Analysis errors (1200-1299)
19
+ IoCErrorCode["ANALYSIS_FAILED"] = "IOC_1200";
20
+ IoCErrorCode["NO_CLASSES_FOUND"] = "IOC_1201";
21
+ IoCErrorCode["CIRCULAR_DEPENDENCY"] = "IOC_1202";
22
+ IoCErrorCode["DUPLICATE_INTERFACE_IMPLEMENTATION"] = "IOC_1203";
23
+ IoCErrorCode["INVALID_INTERFACE_PATTERN"] = "IOC_1204";
24
+ // Generation errors (1300-1399)
25
+ IoCErrorCode["GENERATION_FAILED"] = "IOC_1300";
26
+ IoCErrorCode["OUTPUT_FILE_ERROR"] = "IOC_1301";
27
+ IoCErrorCode["TEMPLATE_ERROR"] = "IOC_1302";
28
+ // Module errors (1400-1499)
29
+ IoCErrorCode["MODULE_CONFIG_INVALID"] = "IOC_1400";
30
+ IoCErrorCode["MODULE_PATTERN_INVALID"] = "IOC_1401";
31
+ IoCErrorCode["MODULE_DUPLICATE_PATTERN"] = "IOC_1402";
32
+ // File system errors (1500-1599)
33
+ IoCErrorCode["FILE_NOT_FOUND"] = "IOC_1500";
34
+ IoCErrorCode["FILE_READ_ERROR"] = "IOC_1501";
35
+ IoCErrorCode["FILE_WRITE_ERROR"] = "IOC_1502";
36
+ IoCErrorCode["PERMISSION_DENIED"] = "IOC_1503";
37
+ // Validation errors (1600-1699)
38
+ IoCErrorCode["VALIDATION_ERROR"] = "IOC_1600";
39
+ IoCErrorCode["SCHEMA_VALIDATION_ERROR"] = "IOC_1601";
40
+ IoCErrorCode["TYPE_VALIDATION_ERROR"] = "IOC_1602";
41
+ // Runtime errors (1700-1799)
42
+ IoCErrorCode["RUNTIME_ERROR"] = "IOC_1700";
43
+ IoCErrorCode["UNEXPECTED_ERROR"] = "IOC_1701";
44
+ IoCErrorCode["INITIALIZATION_ERROR"] = "IOC_1702";
45
+ // Renderer errors (1800-1899)
46
+ IoCErrorCode["RENDERER_NOT_FOUND"] = "IOC_1800";
47
+ IoCErrorCode["RENDERER_ERROR"] = "IOC_1801";
48
+ })(IoCErrorCode || (exports.IoCErrorCode = IoCErrorCode = {}));
49
+ /**
50
+ * Severity levels for errors
51
+ */
52
+ var ErrorSeverity;
53
+ (function (ErrorSeverity) {
54
+ ErrorSeverity["LOW"] = "low";
55
+ ErrorSeverity["MEDIUM"] = "medium";
56
+ ErrorSeverity["HIGH"] = "high";
57
+ ErrorSeverity["CRITICAL"] = "critical";
58
+ })(ErrorSeverity || (exports.ErrorSeverity = ErrorSeverity = {}));
59
+ /**
60
+ * Base IoC error class with custom error codes
61
+ */
62
+ class IoCError extends Error {
63
+ constructor(code, message, severity = ErrorSeverity.MEDIUM, context, suggestions) {
64
+ super(message);
65
+ this.name = 'IoCError';
66
+ this.code = code;
67
+ this.severity = severity;
68
+ this.context = context;
69
+ this.timestamp = new Date();
70
+ this.suggestions = suggestions;
71
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
72
+ if (Error.captureStackTrace) {
73
+ Error.captureStackTrace(this, IoCError);
74
+ }
75
+ }
76
+ /**
77
+ * Get a formatted error message with code and context
78
+ */
79
+ getFormattedMessage() {
80
+ let message = `[${this.code}] ${this.message}`;
81
+ if (this.context) {
82
+ const contextParts = [];
83
+ if (this.context.filePath) {
84
+ contextParts.push(`File: ${this.context.filePath}`);
85
+ }
86
+ if (this.context.lineNumber) {
87
+ contextParts.push(`Line: ${this.context.lineNumber}`);
88
+ }
89
+ if (this.context.className) {
90
+ contextParts.push(`Class: ${this.context.className}`);
91
+ }
92
+ if (this.context.interfaceName) {
93
+ contextParts.push(`Interface: ${this.context.interfaceName}`);
94
+ }
95
+ if (this.context.moduleName) {
96
+ contextParts.push(`Module: ${this.context.moduleName}`);
97
+ }
98
+ if (contextParts.length > 0) {
99
+ message += `\n Context: ${contextParts.join(', ')}`;
100
+ }
101
+ }
102
+ if (this.suggestions && this.suggestions.length > 0) {
103
+ message += `\n Suggestions:`;
104
+ this.suggestions.forEach(suggestion => {
105
+ message += `\n • ${suggestion}`;
106
+ });
107
+ }
108
+ return message;
109
+ }
110
+ /**
111
+ * Convert error to JSON for logging or API responses
112
+ */
113
+ toJSON() {
114
+ return {
115
+ name: this.name,
116
+ code: this.code,
117
+ message: this.message,
118
+ severity: this.severity,
119
+ context: this.context,
120
+ timestamp: this.timestamp.toISOString(),
121
+ suggestions: this.suggestions,
122
+ stack: this.stack
123
+ };
124
+ }
125
+ }
126
+ exports.IoCError = IoCError;
127
+ /**
128
+ * Configuration-specific error
129
+ */
130
+ class ConfigError extends IoCError {
131
+ constructor(code, message, context, suggestions) {
132
+ super(code, message, ErrorSeverity.HIGH, context, suggestions);
133
+ this.name = 'ConfigError';
134
+ }
135
+ }
136
+ exports.ConfigError = ConfigError;
137
+ /**
138
+ * Analysis-specific error
139
+ */
140
+ class AnalysisError extends IoCError {
141
+ constructor(code, message, context, suggestions) {
142
+ super(code, message, ErrorSeverity.MEDIUM, context, suggestions);
143
+ this.name = 'AnalysisError';
144
+ }
145
+ }
146
+ exports.AnalysisError = AnalysisError;
147
+ /**
148
+ * Generation-specific error
149
+ */
150
+ class GenerationError extends IoCError {
151
+ constructor(code, message, context, suggestions) {
152
+ super(code, message, ErrorSeverity.HIGH, context, suggestions);
153
+ this.name = 'GenerationError';
154
+ }
155
+ }
156
+ exports.GenerationError = GenerationError;
157
+ /**
158
+ * Validation-specific error
159
+ */
160
+ class ValidationError extends IoCError {
161
+ constructor(code, message, context, suggestions) {
162
+ super(code, message, ErrorSeverity.MEDIUM, context, suggestions);
163
+ this.name = 'ValidationError';
164
+ }
165
+ }
166
+ exports.ValidationError = ValidationError;
167
+ /**
168
+ * File system-specific error
169
+ */
170
+ class FileSystemError extends IoCError {
171
+ constructor(code, message, context, suggestions) {
172
+ super(code, message, ErrorSeverity.HIGH, context, suggestions);
173
+ this.name = 'FileSystemError';
174
+ }
175
+ }
176
+ exports.FileSystemError = FileSystemError;
177
+ //# sourceMappingURL=IoCError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IoCError.js","sourceRoot":"","sources":["../../src/errors/IoCError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YAgDX;AAhDD,WAAY,YAAY;IACtB,mCAAmC;IACnC,2CAA2B,CAAA;IAC3B,kDAAkC,CAAA;IAClC,+CAA+B,CAAA;IAC/B,oDAAoC,CAAA;IAEpC,sCAAsC;IACtC,iDAAiC,CAAA;IACjC,sDAAsC,CAAA;IACtC,6CAA6B,CAAA;IAE7B,8BAA8B;IAC9B,4CAA4B,CAAA;IAC5B,6CAA6B,CAAA;IAC7B,gDAAgC,CAAA;IAChC,+DAA+C,CAAA;IAC/C,sDAAsC,CAAA;IAEtC,gCAAgC;IAChC,8CAA8B,CAAA;IAC9B,8CAA8B,CAAA;IAC9B,2CAA2B,CAAA;IAE3B,4BAA4B;IAC5B,kDAAkC,CAAA;IAClC,mDAAmC,CAAA;IACnC,qDAAqC,CAAA;IAErC,iCAAiC;IACjC,2CAA2B,CAAA;IAC3B,4CAA4B,CAAA;IAC5B,6CAA6B,CAAA;IAC7B,8CAA8B,CAAA;IAE9B,gCAAgC;IAChC,6CAA6B,CAAA;IAC7B,oDAAoC,CAAA;IACpC,kDAAkC,CAAA;IAElC,6BAA6B;IAC7B,0CAA0B,CAAA;IAC1B,6CAA6B,CAAA;IAC7B,iDAAiC,CAAA;IAEjC,8BAA8B;IAC9B,+CAA+B,CAAA;IAC/B,2CAA2B,CAAA;AAC7B,CAAC,EAhDW,YAAY,4BAAZ,YAAY,QAgDvB;AAED;;GAEG;AACH,IAAY,aAKX;AALD,WAAY,aAAa;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AAC,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAVD,0CAUC"}
@@ -0,0 +1,33 @@
1
+ import { IoCError, IoCErrorCode, ErrorContext, ConfigError, AnalysisError, GenerationError, ValidationError, FileSystemError } from './IoCError.js';
2
+ /**
3
+ * Factory functions for creating specific IoC errors
4
+ */
5
+ export declare class ErrorFactory {
6
+ static configNotFound(filePath: string): ConfigError;
7
+ static configParseError(filePath: string, parseError: string): ConfigError;
8
+ static configValidationError(property: string, value: any, expectedType: string): ConfigError;
9
+ static sourceDirectoryNotFound(sourcePath: string): FileSystemError;
10
+ static sourceDirectoryEmpty(sourcePath: string): AnalysisError;
11
+ static noClassesFound(sourcePath: string): AnalysisError;
12
+ static circularDependency(className: string, dependencyChain: string[]): AnalysisError;
13
+ static duplicateInterfaceImplementation(interfaceName: string, classes: string[]): AnalysisError;
14
+ static generationFailed(reason: string, outputPath?: string): GenerationError;
15
+ static outputFileError(outputPath: string, error: string): GenerationError;
16
+ static moduleConfigInvalid(moduleName: string, reason: string): ValidationError;
17
+ static modulePatternInvalid(pattern: string, moduleName: string): ValidationError;
18
+ static fileNotFound(filePath: string): FileSystemError;
19
+ static fileReadError(filePath: string, error: string): FileSystemError;
20
+ static fileWriteError(filePath: string, error: string): FileSystemError;
21
+ static validationError(message: string, context?: ErrorContext): ValidationError;
22
+ static unexpectedError(error: Error, context?: ErrorContext): IoCError;
23
+ static rendererNotFound(rendererName: string): IoCError;
24
+ /**
25
+ * Wrap a generic error with IoC error context
26
+ */
27
+ static wrapError(error: Error, code: IoCErrorCode, context?: ErrorContext): IoCError;
28
+ /**
29
+ * Create error from validation result
30
+ */
31
+ static fromValidationResult(property: string, value: any, expectedType: string, context?: ErrorContext): ValidationError;
32
+ }
33
+ //# sourceMappingURL=errorFactory.d.ts.map
@@ -0,0 +1 @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;IAcjF,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAatD,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe;IAatE,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe;IAcvE,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe;IAchF,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,QAAQ;IAetE,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ;IAcvD;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,QAAQ;IAapF;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe;CAYzH"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorFactory = void 0;
4
+ const IoCError_js_1 = require("./IoCError.js");
5
+ /**
6
+ * Factory functions for creating specific IoC errors
7
+ */
8
+ class ErrorFactory {
9
+ // Configuration errors
10
+ static configNotFound(filePath) {
11
+ return new IoCError_js_1.ConfigError(IoCError_js_1.IoCErrorCode.CONFIG_FILE_NOT_FOUND, `Configuration file not found: ${filePath}`, { filePath }, [
12
+ 'Create an ioc.config.json file in your project root',
13
+ 'Use --config flag to specify a different config file path',
14
+ 'Run with --help to see configuration options'
15
+ ]);
16
+ }
17
+ static configParseError(filePath, parseError) {
18
+ return new IoCError_js_1.ConfigError(IoCError_js_1.IoCErrorCode.CONFIG_PARSE_ERROR, `Failed to parse configuration file: ${parseError}`, { filePath }, [
19
+ 'Check JSON syntax in your configuration file',
20
+ 'Validate JSON using an online JSON validator',
21
+ 'Ensure all strings are properly quoted'
22
+ ]);
23
+ }
24
+ static configValidationError(property, value, expectedType) {
25
+ return new IoCError_js_1.ConfigError(IoCError_js_1.IoCErrorCode.CONFIG_VALIDATION_ERROR, `Invalid configuration property '${property}': expected ${expectedType}, got ${typeof value}`, { configProperty: property }, [
26
+ `Set '${property}' to a valid ${expectedType}`,
27
+ 'Check the configuration documentation for valid values',
28
+ 'Remove the property to use default value'
29
+ ]);
30
+ }
31
+ // Source directory errors
32
+ static sourceDirectoryNotFound(sourcePath) {
33
+ return new IoCError_js_1.FileSystemError(IoCError_js_1.IoCErrorCode.SOURCE_DIR_NOT_FOUND, `Source directory not found: ${sourcePath}`, { filePath: sourcePath }, [
34
+ 'Check if the source directory path is correct',
35
+ 'Ensure the directory exists',
36
+ 'Use absolute path if relative path is not working'
37
+ ]);
38
+ }
39
+ static sourceDirectoryEmpty(sourcePath) {
40
+ return new IoCError_js_1.AnalysisError(IoCError_js_1.IoCErrorCode.SOURCE_DIR_EMPTY, `Source directory contains no TypeScript files: ${sourcePath}`, { filePath: sourcePath }, [
41
+ 'Add TypeScript files to the source directory',
42
+ 'Check if files have .ts extension',
43
+ 'Verify exclude patterns are not filtering out all files'
44
+ ]);
45
+ }
46
+ // Analysis errors
47
+ static noClassesFound(sourcePath) {
48
+ return new IoCError_js_1.AnalysisError(IoCError_js_1.IoCErrorCode.NO_CLASSES_FOUND, `No classes found for dependency injection in: ${sourcePath}`, { filePath: sourcePath }, [
49
+ 'Add classes that implement interfaces or extend abstract classes',
50
+ 'Check if classes are properly exported',
51
+ 'Verify interface patterns match your interfaces',
52
+ 'Ensure abstract classes are properly declared with "abstract" keyword'
53
+ ]);
54
+ }
55
+ static circularDependency(className, dependencyChain) {
56
+ return new IoCError_js_1.AnalysisError(IoCError_js_1.IoCErrorCode.CIRCULAR_DEPENDENCY, `Circular dependency detected in class '${className}': ${dependencyChain.join(' -> ')}`, { className }, [
57
+ 'Refactor classes to remove circular dependencies',
58
+ 'Use interfaces to break dependency cycles',
59
+ 'Consider using factory pattern or lazy loading'
60
+ ]);
61
+ }
62
+ static duplicateInterfaceImplementation(interfaceName, classes) {
63
+ return new IoCError_js_1.AnalysisError(IoCError_js_1.IoCErrorCode.DUPLICATE_INTERFACE_IMPLEMENTATION, `Multiple implementations found for interface '${interfaceName}': ${classes.join(', ')}`, { interfaceName }, [
64
+ 'Use different interface names for different implementations',
65
+ 'Configure module-specific bindings',
66
+ 'Use qualifiers to distinguish implementations'
67
+ ]);
68
+ }
69
+ // Generation errors
70
+ static generationFailed(reason, outputPath) {
71
+ return new IoCError_js_1.GenerationError(IoCError_js_1.IoCErrorCode.GENERATION_FAILED, `Container generation failed: ${reason}`, { filePath: outputPath }, [
72
+ 'Check if output directory is writable',
73
+ 'Verify all dependencies are resolvable',
74
+ 'Review analysis results for errors'
75
+ ]);
76
+ }
77
+ static outputFileError(outputPath, error) {
78
+ return new IoCError_js_1.GenerationError(IoCError_js_1.IoCErrorCode.OUTPUT_FILE_ERROR, `Failed to write output file '${outputPath}': ${error}`, { filePath: outputPath }, [
79
+ 'Check if output directory exists and is writable',
80
+ 'Ensure sufficient disk space',
81
+ 'Verify file permissions'
82
+ ]);
83
+ }
84
+ // Module errors
85
+ static moduleConfigInvalid(moduleName, reason) {
86
+ return new IoCError_js_1.ValidationError(IoCError_js_1.IoCErrorCode.MODULE_CONFIG_INVALID, `Invalid module configuration for '${moduleName}': ${reason}`, { moduleName }, [
87
+ 'Check module configuration syntax',
88
+ 'Verify all required properties are present',
89
+ 'Review module configuration documentation'
90
+ ]);
91
+ }
92
+ static modulePatternInvalid(pattern, moduleName) {
93
+ return new IoCError_js_1.ValidationError(IoCError_js_1.IoCErrorCode.MODULE_PATTERN_INVALID, `Invalid pattern '${pattern}' in module '${moduleName}'`, { moduleName }, [
94
+ 'Use valid glob patterns (e.g., **/*.service.ts)',
95
+ 'Check pattern syntax documentation',
96
+ 'Test patterns with a glob testing tool'
97
+ ]);
98
+ }
99
+ // File system errors
100
+ static fileNotFound(filePath) {
101
+ return new IoCError_js_1.FileSystemError(IoCError_js_1.IoCErrorCode.FILE_NOT_FOUND, `File not found: ${filePath}`, { filePath }, [
102
+ 'Check if the file path is correct',
103
+ 'Ensure the file exists',
104
+ 'Verify file permissions'
105
+ ]);
106
+ }
107
+ static fileReadError(filePath, error) {
108
+ return new IoCError_js_1.FileSystemError(IoCError_js_1.IoCErrorCode.FILE_READ_ERROR, `Failed to read file '${filePath}': ${error}`, { filePath }, [
109
+ 'Check file permissions',
110
+ 'Ensure file is not locked by another process',
111
+ 'Verify file is not corrupted'
112
+ ]);
113
+ }
114
+ static fileWriteError(filePath, error) {
115
+ return new IoCError_js_1.FileSystemError(IoCError_js_1.IoCErrorCode.FILE_WRITE_ERROR, `Failed to write file '${filePath}': ${error}`, { filePath }, [
116
+ 'Check directory permissions',
117
+ 'Ensure sufficient disk space',
118
+ 'Verify parent directory exists'
119
+ ]);
120
+ }
121
+ // Validation errors
122
+ static validationError(message, context) {
123
+ return new IoCError_js_1.ValidationError(IoCError_js_1.IoCErrorCode.VALIDATION_ERROR, message, context, [
124
+ 'Review the validation requirements',
125
+ 'Check input data format',
126
+ 'Consult documentation for valid values'
127
+ ]);
128
+ }
129
+ // Runtime errors
130
+ static unexpectedError(error, context) {
131
+ return new IoCError_js_1.IoCError(IoCError_js_1.IoCErrorCode.UNEXPECTED_ERROR, `Unexpected error: ${error.message}`, IoCError_js_1.ErrorSeverity.CRITICAL, context, [
132
+ 'Report this issue to the development team',
133
+ 'Include the full error stack trace',
134
+ 'Provide steps to reproduce the error'
135
+ ]);
136
+ }
137
+ // Renderer errors
138
+ static rendererNotFound(rendererName) {
139
+ return new IoCError_js_1.IoCError(IoCError_js_1.IoCErrorCode.RENDERER_NOT_FOUND, `Renderer not found: ${rendererName}`, IoCError_js_1.ErrorSeverity.HIGH, undefined, [
140
+ 'Check if the renderer name is correct',
141
+ 'Verify available renderers with --list-renderers',
142
+ 'Use a supported renderer (mermaid, plantuml, etc.)'
143
+ ]);
144
+ }
145
+ /**
146
+ * Wrap a generic error with IoC error context
147
+ */
148
+ static wrapError(error, code, context) {
149
+ if (error instanceof IoCError_js_1.IoCError) {
150
+ return error;
151
+ }
152
+ return new IoCError_js_1.IoCError(code, error.message, IoCError_js_1.ErrorSeverity.MEDIUM, context);
153
+ }
154
+ /**
155
+ * Create error from validation result
156
+ */
157
+ static fromValidationResult(property, value, expectedType, context) {
158
+ return new IoCError_js_1.ValidationError(IoCError_js_1.IoCErrorCode.SCHEMA_VALIDATION_ERROR, `Validation failed for property '${property}': expected ${expectedType}, got ${typeof value}`, { ...context, configProperty: property }, [
159
+ `Ensure '${property}' is of type ${expectedType}`,
160
+ 'Check the schema documentation',
161
+ 'Validate your input against the expected format'
162
+ ]);
163
+ }
164
+ }
165
+ exports.ErrorFactory = ErrorFactory;
166
+ //# sourceMappingURL=errorFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorFactory.js","sourceRoot":"","sources":["../../src/errors/errorFactory.ts"],"names":[],"mappings":";;;AAAA,+CAUuB;AAEvB;;GAEG;AACH,MAAa,YAAY;IACvB,uBAAuB;IACvB,MAAM,CAAC,cAAc,CAAC,QAAgB;QACpC,OAAO,IAAI,yBAAW,CACpB,0BAAY,CAAC,qBAAqB,EAClC,iCAAiC,QAAQ,EAAE,EAC3C,EAAE,QAAQ,EAAE,EACZ;YACE,qDAAqD;YACrD,2DAA2D;YAC3D,8CAA8C;SAC/C,CACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAAgB,EAAE,UAAkB;QAC1D,OAAO,IAAI,yBAAW,CACpB,0BAAY,CAAC,kBAAkB,EAC/B,uCAAuC,UAAU,EAAE,EACnD,EAAE,QAAQ,EAAE,EACZ;YACE,8CAA8C;Y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KAAY,EAAE,OAAsB;QACzD,OAAO,IAAI,sBAAQ,CACjB,0BAAY,CAAC,gBAAgB,EAC7B,qBAAqB,KAAK,CAAC,OAAO,EAAE,EACpC,2BAAa,CAAC,QAAQ,EACtB,OAAO,EACP;YACE,2CAA2C;YAC3C,oCAAoC;YACpC,sCAAsC;SACvC,CACF,CAAC;IACJ,CAAC;IAED,kBAAkB;IAClB,MAAM,CAAC,gBAAgB,CAAC,YAAoB;QAC1C,OAAO,IAAI,sBAAQ,CACjB,0BAAY,CAAC,kBAAkB,EAC/B,uBAAuB,YAAY,EAAE,EACrC,2BAAa,CAAC,IAAI,EAClB,SAAS,EACT;YACE,uCAAuC;YACvC,kDAAkD;YAClD,oDAAoD;SACrD,CACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,KAAY,EAAE,IAAkB,EAAE,OAAsB;QACvE,IAAI,KAAK,YAAY,sBAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,sBAAQ,CACjB,IAAI,EACJ,KAAK,CAAC,OAAO,EACb,2BAAa,CAAC,MAAM,EACpB,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAgB,EAAE,KAAU,EAAE,YAAoB,EAAE,OAAsB;QACpG,OAAO,IAAI,6BAAe,CACxB,0BAAY,CAAC,uBAAuB,EACpC,mCAAmC,QAAQ,eAAe,YAAY,SAAS,OAAO,KAAK,EAAE,EAC7F,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,EACxC;YACE,WAAW,QAAQ,gBAAgB,YAAY,EAAE;YACjD,gCAAgC;YAChC,iDAAiD;SAClD,CACF,CAAC;IACJ,CAAC;CACF;AAtRD,oCAsRC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * IoC Arise CLI Error System
3
+ *
4
+ * This module provides a comprehensive error handling system with:
5
+ * - Custom error codes for different error categories
6
+ * - Structured error classes with context and suggestions
7
+ * - Factory functions for creating specific errors
8
+ * - Consistent error formatting and logging
9
+ */
10
+ import { IoCError } from './IoCError.js';
11
+ export { IoCError, IoCErrorCode, ErrorSeverity, ConfigError, AnalysisError, GenerationError, ValidationError, FileSystemError } from './IoCError.js';
12
+ export type { ErrorContext } from './IoCError.js';
13
+ export { ErrorFactory } from './errorFactory.js';
14
+ /**
15
+ * Utility functions for error handling
16
+ */
17
+ export declare class ErrorUtils {
18
+ private static IoCError;
19
+ /**
20
+ * Check if an error is an IoC error
21
+ */
22
+ static isIoCError(error: any): error is IoCError;
23
+ /**
24
+ * Get error code from any error
25
+ */
26
+ static getErrorCode(error: any): string | undefined;
27
+ /**
28
+ * Format error for console output
29
+ */
30
+ static formatForConsole(error: any): string;
31
+ /**
32
+ * Extract stack trace from error
33
+ */
34
+ static getStackTrace(error: any): string | undefined;
35
+ /**
36
+ * Check if error is critical
37
+ */
38
+ static isCritical(error: any): boolean;
39
+ /**
40
+ * Get suggestions from error
41
+ */
42
+ static getSuggestions(error: any): string[];
43
+ }
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAY;IACnC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ;IAIhD;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS;IAOnD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM;IAO3C;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS;IAIpD;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAOtC;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,EAAE;CAM5C"}