mcpize 1.0.5 → 1.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.
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +53 -5
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +253 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +3 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cache.js +1 -1
- package/dist/lib/cache.js.map +1 -1
- package/dist/lib/error-analyzers/base.d.ts +47 -0
- package/dist/lib/error-analyzers/base.d.ts.map +1 -0
- package/dist/lib/error-analyzers/base.js +39 -0
- package/dist/lib/error-analyzers/base.js.map +1 -0
- package/dist/lib/error-analyzers/common.d.ts +11 -0
- package/dist/lib/error-analyzers/common.d.ts.map +1 -0
- package/dist/lib/error-analyzers/common.js +109 -0
- package/dist/lib/error-analyzers/common.js.map +1 -0
- package/dist/lib/error-analyzers/index.d.ts +38 -0
- package/dist/lib/error-analyzers/index.d.ts.map +1 -0
- package/dist/lib/error-analyzers/index.js +164 -0
- package/dist/lib/error-analyzers/index.js.map +1 -0
- package/dist/lib/error-analyzers/nodejs.d.ts +7 -0
- package/dist/lib/error-analyzers/nodejs.d.ts.map +1 -0
- package/dist/lib/error-analyzers/nodejs.js +149 -0
- package/dist/lib/error-analyzers/nodejs.js.map +1 -0
- package/dist/lib/error-analyzers/python.d.ts +6 -0
- package/dist/lib/error-analyzers/python.d.ts.map +1 -0
- package/dist/lib/error-analyzers/python.js +160 -0
- package/dist/lib/error-analyzers/python.js.map +1 -0
- package/dist/lib/validation.d.ts +22 -1
- package/dist/lib/validation.d.ts.map +1 -1
- package/dist/lib/validation.js +233 -2
- package/dist/lib/validation.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interfaces for runtime-specific error analyzers
|
|
3
|
+
*/
|
|
4
|
+
export interface LogEntry {
|
|
5
|
+
timestamp: string;
|
|
6
|
+
severity: string;
|
|
7
|
+
message: string;
|
|
8
|
+
insertId: string;
|
|
9
|
+
labels?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
export interface PatternMatch {
|
|
12
|
+
detail?: string;
|
|
13
|
+
suggestion?: string;
|
|
14
|
+
category?: ErrorCategory;
|
|
15
|
+
}
|
|
16
|
+
export type ErrorCategory = "runtime" | "startup" | "build" | "config" | "unknown";
|
|
17
|
+
export interface ErrorPattern {
|
|
18
|
+
/** Human-readable name for this pattern */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Check if this pattern matches the log message */
|
|
21
|
+
match: (msg: string) => boolean;
|
|
22
|
+
/** Extract details and suggestions from the message */
|
|
23
|
+
extract: (msg: string) => PatternMatch | null;
|
|
24
|
+
}
|
|
25
|
+
export interface RuntimeAnalyzer {
|
|
26
|
+
/** Runtime identifier (nodejs, python, php, etc.) */
|
|
27
|
+
runtime: string;
|
|
28
|
+
/** Display name for error messages */
|
|
29
|
+
displayName: string;
|
|
30
|
+
/** Runtime-specific error patterns */
|
|
31
|
+
patterns: ErrorPattern[];
|
|
32
|
+
}
|
|
33
|
+
export interface DeploymentErrorAnalysis {
|
|
34
|
+
category: ErrorCategory;
|
|
35
|
+
summary: string;
|
|
36
|
+
details: string[];
|
|
37
|
+
suggestions: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Apply patterns to log messages and collect matches
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyPatterns(logs: LogEntry[], patterns: ErrorPattern[]): {
|
|
43
|
+
details: string[];
|
|
44
|
+
suggestions: string[];
|
|
45
|
+
category: ErrorCategory;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1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vB;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,CAkCvE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interfaces for runtime-specific error analyzers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Apply patterns to log messages and collect matches
|
|
6
|
+
*/
|
|
7
|
+
export function applyPatterns(logs, patterns) {
|
|
8
|
+
const details = [];
|
|
9
|
+
const suggestions = [];
|
|
10
|
+
let category = "unknown";
|
|
11
|
+
for (const log of logs) {
|
|
12
|
+
const msg = log.message;
|
|
13
|
+
for (const pattern of patterns) {
|
|
14
|
+
if (pattern.match(msg)) {
|
|
15
|
+
const result = pattern.extract(msg);
|
|
16
|
+
if (result) {
|
|
17
|
+
if (result.detail) {
|
|
18
|
+
details.push(result.detail);
|
|
19
|
+
}
|
|
20
|
+
if (result.suggestion) {
|
|
21
|
+
suggestions.push(result.suggestion);
|
|
22
|
+
}
|
|
23
|
+
if (result.category) {
|
|
24
|
+
// More specific categories take precedence
|
|
25
|
+
if (category === "unknown" || result.category !== "unknown") {
|
|
26
|
+
category = result.category;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
details: [...new Set(details)],
|
|
35
|
+
suggestions: [...new Set(suggestions)],
|
|
36
|
+
category,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/lib/error-analyzers/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AA2CH;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAgB,EAChB,QAAwB;IAExB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,QAAQ,GAAkB,SAAS,CAAC;IAExC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;QAExB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAI,MAAM,EAAE,CAAC;oBACX,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;wBAClB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC9B,CAAC;oBACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;wBACtB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;oBACtC,CAAC;oBACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;wBACpB,2CAA2C;wBAC3C,IAAI,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;4BAC5D,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;wBAC7B,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9B,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;QACtC,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common error patterns shared across all runtimes
|
|
3
|
+
* These patterns detect Cloud Run / container-level issues
|
|
4
|
+
*/
|
|
5
|
+
import type { ErrorPattern } from "./base.js";
|
|
6
|
+
export declare const commonPatterns: ErrorPattern[];
|
|
7
|
+
/**
|
|
8
|
+
* Patterns for environment variable issues (common across runtimes)
|
|
9
|
+
*/
|
|
10
|
+
export declare const envVarPatterns: ErrorPattern[];
|
|
11
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/lib/error-analyzers/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,YAAY,EAgGxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,EAkBxC,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common error patterns shared across all runtimes
|
|
3
|
+
* These patterns detect Cloud Run / container-level issues
|
|
4
|
+
*/
|
|
5
|
+
export const commonPatterns = [
|
|
6
|
+
// Container exit codes
|
|
7
|
+
{
|
|
8
|
+
name: "container-exit",
|
|
9
|
+
match: (msg) => msg.includes("Container called exit("),
|
|
10
|
+
extract: (msg) => {
|
|
11
|
+
const exitMatch = msg.match(/exit\((\d+)\)/);
|
|
12
|
+
const code = exitMatch?.[1] || "unknown";
|
|
13
|
+
return {
|
|
14
|
+
detail: `Container exited with code ${code}`,
|
|
15
|
+
category: "runtime",
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
// Startup probe failures
|
|
20
|
+
{
|
|
21
|
+
name: "startup-probe-failed",
|
|
22
|
+
match: (msg) => msg.includes("STARTUP TCP probe failed") ||
|
|
23
|
+
msg.includes("container failed to start"),
|
|
24
|
+
extract: () => ({
|
|
25
|
+
detail: "Container failed to start and listen on port 8080",
|
|
26
|
+
category: "startup",
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
// Port binding issues
|
|
30
|
+
{
|
|
31
|
+
name: "port-binding",
|
|
32
|
+
match: (msg) => (msg.includes("PORT=8080") || msg.includes("port 8080")) &&
|
|
33
|
+
(msg.includes("failed") || msg.includes("timeout")),
|
|
34
|
+
extract: () => ({
|
|
35
|
+
suggestion: "Ensure your server listens on PORT environment variable (default 8080)",
|
|
36
|
+
category: "startup",
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
// Timeout issues
|
|
40
|
+
{
|
|
41
|
+
name: "startup-timeout",
|
|
42
|
+
match: (msg) => msg.includes("timeout") && msg.includes("allocated"),
|
|
43
|
+
extract: () => ({
|
|
44
|
+
suggestion: "Server took too long to start. Check for blocking operations during startup.",
|
|
45
|
+
category: "startup",
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
// Memory issues
|
|
49
|
+
{
|
|
50
|
+
name: "out-of-memory",
|
|
51
|
+
match: (msg) => msg.includes("out of memory") ||
|
|
52
|
+
msg.includes("OOMKilled") ||
|
|
53
|
+
msg.includes("memory limit"),
|
|
54
|
+
extract: () => ({
|
|
55
|
+
detail: "Container ran out of memory",
|
|
56
|
+
suggestion: "Reduce memory usage or increase memory limit in mcpize.yaml",
|
|
57
|
+
category: "runtime",
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
// Permission denied
|
|
61
|
+
{
|
|
62
|
+
name: "permission-denied",
|
|
63
|
+
match: (msg) => msg.includes("permission denied") || msg.includes("EACCES"),
|
|
64
|
+
extract: () => ({
|
|
65
|
+
detail: "Permission denied error",
|
|
66
|
+
suggestion: "Check file permissions in your Dockerfile",
|
|
67
|
+
category: "runtime",
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
// Network errors
|
|
71
|
+
{
|
|
72
|
+
name: "network-error",
|
|
73
|
+
match: (msg) => msg.includes("ECONNREFUSED") ||
|
|
74
|
+
msg.includes("ETIMEDOUT") ||
|
|
75
|
+
msg.includes("getaddrinfo"),
|
|
76
|
+
extract: (msg) => {
|
|
77
|
+
const hostMatch = msg.match(/(?:ECONNREFUSED|connect to)\s+([^\s]+)/i);
|
|
78
|
+
return {
|
|
79
|
+
detail: hostMatch
|
|
80
|
+
? `Network error connecting to ${hostMatch[1]}`
|
|
81
|
+
: "Network connection error",
|
|
82
|
+
suggestion: "Check if external services are accessible",
|
|
83
|
+
category: "runtime",
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Patterns for environment variable issues (common across runtimes)
|
|
90
|
+
*/
|
|
91
|
+
export const envVarPatterns = [
|
|
92
|
+
{
|
|
93
|
+
name: "missing-env-var",
|
|
94
|
+
match: (msg) => msg.includes("environment variable"),
|
|
95
|
+
extract: (msg) => {
|
|
96
|
+
// Match uppercase env var names like POKEMON_API_KEY, DATABASE_URL
|
|
97
|
+
const envMatch = msg.match(/\b([A-Z][A-Z0-9_]{2,})\b/);
|
|
98
|
+
const systemVars = ["PORT", "NODE_ENV", "PATH", "HOME", "USER", "PWD"];
|
|
99
|
+
if (envMatch && !systemVars.includes(envMatch[1])) {
|
|
100
|
+
return {
|
|
101
|
+
suggestion: `Set the missing secret: mcpize secrets set ${envMatch[1]} <value>`,
|
|
102
|
+
category: "config",
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/lib/error-analyzers/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,uBAAuB;IACvB;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACtD,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACf,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK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AK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACpD,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACf,mEAAmE;YACnE,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YACvD,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAEvE,IAAI,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClD,OAAO;oBACL,UAAU,EAAE,8CAA8C,QAAQ,CAAC,CAAC,CAAC,UAAU;oBAC/E,QAAQ,EAAE,QAAQ;iBACnB,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Analyzers - Runtime-specific log analysis for deployment failures
|
|
3
|
+
*
|
|
4
|
+
* Architecture:
|
|
5
|
+
* - base.ts: Interfaces and utility functions
|
|
6
|
+
* - common.ts: Patterns shared across all runtimes (container, port, memory)
|
|
7
|
+
* - nodejs.ts: Node.js/TypeScript specific patterns
|
|
8
|
+
* - python.ts: Python specific patterns
|
|
9
|
+
* - (future) php.ts: PHP specific patterns
|
|
10
|
+
*/
|
|
11
|
+
import type { LogEntry, RuntimeAnalyzer, DeploymentErrorAnalysis, ErrorCategory } from "./base.js";
|
|
12
|
+
export type { LogEntry, DeploymentErrorAnalysis, ErrorCategory };
|
|
13
|
+
/**
|
|
14
|
+
* Get the appropriate analyzer for a runtime
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAnalyzer(runtime: string): RuntimeAnalyzer;
|
|
17
|
+
/**
|
|
18
|
+
* Analyze deployment failure logs and return structured error information
|
|
19
|
+
*
|
|
20
|
+
* @param logs - Array of log entries from Cloud Logging
|
|
21
|
+
* @param runtime - The runtime of the server (nodejs, python, etc.)
|
|
22
|
+
* @param errorMessage - Optional error message from deployment status
|
|
23
|
+
* @returns Structured error analysis with details and suggestions
|
|
24
|
+
*/
|
|
25
|
+
export declare function analyzeDeploymentLogs(logs: LogEntry[], runtime: string, errorMessage?: string): DeploymentErrorAnalysis;
|
|
26
|
+
/**
|
|
27
|
+
* Format error analysis for console output
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatErrorAnalysis(analysis: DeploymentErrorAnalysis, chalk: {
|
|
30
|
+
red: {
|
|
31
|
+
bold: (s: string) => string;
|
|
32
|
+
};
|
|
33
|
+
yellow: (s: string) => string;
|
|
34
|
+
cyan: (s: string) => string;
|
|
35
|
+
white: (s: string) => string;
|
|
36
|
+
dim: (s: string) => string;
|
|
37
|
+
}): string;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/error-analyzers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,uBAAuB,EACvB,aAAa,EAEd,MAAM,WAAW,CAAC;AAOnB,YAAY,EAAE,QAAQ,EAAE,uBAAuB,EAAE,aAAa,EAAE,CAAC;AAUjE;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAG5D;AAsED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,EAAE,EAChB,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,uBAAuB,CA6CzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,uBAAuB,EACjC,KAAK,EAAE;IACL,GAAG,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;KAAE,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9B,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5B,GACA,MAAM,CA8BR"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Analyzers - Runtime-specific log analysis for deployment failures
|
|
3
|
+
*
|
|
4
|
+
* Architecture:
|
|
5
|
+
* - base.ts: Interfaces and utility functions
|
|
6
|
+
* - common.ts: Patterns shared across all runtimes (container, port, memory)
|
|
7
|
+
* - nodejs.ts: Node.js/TypeScript specific patterns
|
|
8
|
+
* - python.ts: Python specific patterns
|
|
9
|
+
* - (future) php.ts: PHP specific patterns
|
|
10
|
+
*/
|
|
11
|
+
import { applyPatterns } from "./base.js";
|
|
12
|
+
import { commonPatterns, envVarPatterns } from "./common.js";
|
|
13
|
+
import { nodejsAnalyzer, typescriptAnalyzer } from "./nodejs.js";
|
|
14
|
+
import { pythonAnalyzer } from "./python.js";
|
|
15
|
+
// Registry of all runtime analyzers
|
|
16
|
+
const analyzers = {
|
|
17
|
+
nodejs: nodejsAnalyzer,
|
|
18
|
+
typescript: typescriptAnalyzer,
|
|
19
|
+
python: pythonAnalyzer,
|
|
20
|
+
// Add more runtimes here as needed
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Get the appropriate analyzer for a runtime
|
|
24
|
+
*/
|
|
25
|
+
export function getAnalyzer(runtime) {
|
|
26
|
+
const normalizedRuntime = runtime.toLowerCase();
|
|
27
|
+
return analyzers[normalizedRuntime] || nodejsAnalyzer;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get summary message based on error category
|
|
31
|
+
*/
|
|
32
|
+
function getSummary(category, runtime) {
|
|
33
|
+
const analyzer = getAnalyzer(runtime);
|
|
34
|
+
switch (category) {
|
|
35
|
+
case "runtime":
|
|
36
|
+
return `Runtime error: ${analyzer.displayName} server crashed on startup`;
|
|
37
|
+
case "startup":
|
|
38
|
+
return "Startup failed: Container didn't respond to health check";
|
|
39
|
+
case "build":
|
|
40
|
+
return `Build error: ${analyzer.displayName} compilation failed`;
|
|
41
|
+
case "config":
|
|
42
|
+
return "Configuration error: Missing required settings";
|
|
43
|
+
default:
|
|
44
|
+
return "Deployment failed";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get default suggestions based on error category and runtime
|
|
49
|
+
*/
|
|
50
|
+
function getDefaultSuggestions(category, runtime) {
|
|
51
|
+
const suggestions = [];
|
|
52
|
+
switch (category) {
|
|
53
|
+
case "runtime":
|
|
54
|
+
suggestions.push("Check your code for uncaught exceptions");
|
|
55
|
+
if (runtime === "python") {
|
|
56
|
+
suggestions.push("Test locally with: python main.py");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
suggestions.push("Test locally with: npm run start");
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case "startup":
|
|
63
|
+
suggestions.push("Ensure server starts within 60 seconds");
|
|
64
|
+
suggestions.push("Verify server listens on $PORT (default 8080)");
|
|
65
|
+
if (runtime === "python") {
|
|
66
|
+
suggestions.push("Test locally with: PORT=8080 python main.py");
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
suggestions.push("Test locally with: PORT=8080 npm run start");
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case "build":
|
|
73
|
+
if (runtime === "python") {
|
|
74
|
+
suggestions.push("Check requirements.txt for errors");
|
|
75
|
+
suggestions.push("Run: pip install -r requirements.txt");
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
suggestions.push("Run: npm run build");
|
|
79
|
+
suggestions.push("Fix compilation errors and redeploy");
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case "config":
|
|
83
|
+
suggestions.push("Check mcpize.yaml configuration");
|
|
84
|
+
suggestions.push("Verify all required secrets are set: mcpize secrets list");
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
return suggestions;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Analyze deployment failure logs and return structured error information
|
|
91
|
+
*
|
|
92
|
+
* @param logs - Array of log entries from Cloud Logging
|
|
93
|
+
* @param runtime - The runtime of the server (nodejs, python, etc.)
|
|
94
|
+
* @param errorMessage - Optional error message from deployment status
|
|
95
|
+
* @returns Structured error analysis with details and suggestions
|
|
96
|
+
*/
|
|
97
|
+
export function analyzeDeploymentLogs(logs, runtime, errorMessage) {
|
|
98
|
+
const analyzer = getAnalyzer(runtime);
|
|
99
|
+
// Combine all patterns: common + env vars + runtime-specific
|
|
100
|
+
const allPatterns = [
|
|
101
|
+
...commonPatterns,
|
|
102
|
+
...envVarPatterns,
|
|
103
|
+
...analyzer.patterns,
|
|
104
|
+
];
|
|
105
|
+
// Apply patterns to logs
|
|
106
|
+
const { details, suggestions, category } = applyPatterns(logs, allPatterns);
|
|
107
|
+
// Build final analysis
|
|
108
|
+
const analysis = {
|
|
109
|
+
category,
|
|
110
|
+
summary: getSummary(category, runtime),
|
|
111
|
+
details,
|
|
112
|
+
suggestions,
|
|
113
|
+
};
|
|
114
|
+
// Add default suggestions if none were found
|
|
115
|
+
if (analysis.suggestions.length === 0) {
|
|
116
|
+
analysis.suggestions = getDefaultSuggestions(category, runtime);
|
|
117
|
+
}
|
|
118
|
+
// If no details found, add raw error excerpts
|
|
119
|
+
if (analysis.details.length === 0 && logs.length > 0) {
|
|
120
|
+
for (const log of logs.slice(0, 5)) {
|
|
121
|
+
if (log.severity === "ERROR") {
|
|
122
|
+
const truncated = log.message.length > 300
|
|
123
|
+
? log.message.substring(0, 300) + "..."
|
|
124
|
+
: log.message;
|
|
125
|
+
analysis.details.push(truncated);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Override summary with error message if we couldn't determine category
|
|
130
|
+
if (category === "unknown" && errorMessage) {
|
|
131
|
+
analysis.summary = errorMessage;
|
|
132
|
+
}
|
|
133
|
+
return analysis;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Format error analysis for console output
|
|
137
|
+
*/
|
|
138
|
+
export function formatErrorAnalysis(analysis, chalk) {
|
|
139
|
+
const lines = [];
|
|
140
|
+
lines.push("");
|
|
141
|
+
lines.push(chalk.red.bold(`✖ ${analysis.summary}`));
|
|
142
|
+
lines.push("");
|
|
143
|
+
if (analysis.details.length > 0) {
|
|
144
|
+
lines.push(chalk.yellow("Error details:"));
|
|
145
|
+
for (const detail of analysis.details) {
|
|
146
|
+
// Handle multi-line details
|
|
147
|
+
const detailLines = detail.split("\n").filter((l) => l.trim());
|
|
148
|
+
for (const line of detailLines.slice(0, 5)) {
|
|
149
|
+
lines.push(chalk.dim(` ${line}`));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
lines.push("");
|
|
153
|
+
}
|
|
154
|
+
if (analysis.suggestions.length > 0) {
|
|
155
|
+
lines.push(chalk.cyan("Suggestions:"));
|
|
156
|
+
for (const suggestion of analysis.suggestions) {
|
|
157
|
+
lines.push(chalk.white(` → ${suggestion}`));
|
|
158
|
+
}
|
|
159
|
+
lines.push("");
|
|
160
|
+
}
|
|
161
|
+
lines.push(chalk.dim("For full logs: mcpize logs"));
|
|
162
|
+
return lines.join("\n");
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/error-analyzers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;A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B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodejs.d.ts","sourceRoot":"","sources":["../../../src/lib/error-analyzers/nodejs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,WAAW,CAAC;AAqJ/D,eAAO,MAAM,cAAc,EAAE,eAI5B,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,eAIhC,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js / TypeScript specific error patterns
|
|
3
|
+
*/
|
|
4
|
+
const nodejsPatterns = [
|
|
5
|
+
// JavaScript runtime errors with stack trace
|
|
6
|
+
{
|
|
7
|
+
name: "js-runtime-error",
|
|
8
|
+
match: (msg) => msg.includes("Error:") &&
|
|
9
|
+
(msg.includes("at file://") || msg.includes("at Module")),
|
|
10
|
+
extract: (msg) => {
|
|
11
|
+
const errorMatch = msg.match(/Error: ([^\n]+)/);
|
|
12
|
+
const fileMatch = msg.match(/at file:\/\/([^\s]+):(\d+):(\d+)/);
|
|
13
|
+
const details = [];
|
|
14
|
+
if (errorMatch) {
|
|
15
|
+
details.push(`Runtime Error: ${errorMatch[1]}`);
|
|
16
|
+
}
|
|
17
|
+
if (fileMatch) {
|
|
18
|
+
details.push(`Location: ${fileMatch[1]}:${fileMatch[2]}`);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
detail: details.join("\n"),
|
|
22
|
+
category: "runtime",
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
// Module not found
|
|
27
|
+
{
|
|
28
|
+
name: "module-not-found",
|
|
29
|
+
match: (msg) => msg.includes("Cannot find module") || msg.includes("Module not found"),
|
|
30
|
+
extract: (msg) => {
|
|
31
|
+
const moduleMatch = msg.match(/Cannot find module '([^']+)'/);
|
|
32
|
+
if (moduleMatch) {
|
|
33
|
+
const moduleName = moduleMatch[1];
|
|
34
|
+
// Check if it's a local file or npm package
|
|
35
|
+
if (moduleName.startsWith(".") || moduleName.startsWith("/")) {
|
|
36
|
+
return {
|
|
37
|
+
detail: `Missing file: ${moduleName}`,
|
|
38
|
+
suggestion: "Check if the file exists and path is correct",
|
|
39
|
+
category: "runtime",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
detail: `Missing module: ${moduleName}`,
|
|
44
|
+
suggestion: `Run: npm install ${moduleName}`,
|
|
45
|
+
category: "runtime",
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
// TypeScript compilation errors
|
|
52
|
+
{
|
|
53
|
+
name: "typescript-error",
|
|
54
|
+
match: (msg) => msg.includes("TS") && /TS\d+:/.test(msg),
|
|
55
|
+
extract: (msg) => {
|
|
56
|
+
const tsMatch = msg.match(/(TS\d+):\s*(.+)/);
|
|
57
|
+
return {
|
|
58
|
+
detail: tsMatch ? `TypeScript ${tsMatch[1]}: ${tsMatch[2]}` : msg.substring(0, 200),
|
|
59
|
+
suggestion: "Run: npm run build",
|
|
60
|
+
category: "build",
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
// Syntax errors
|
|
65
|
+
{
|
|
66
|
+
name: "syntax-error",
|
|
67
|
+
match: (msg) => msg.includes("SyntaxError"),
|
|
68
|
+
extract: (msg) => {
|
|
69
|
+
const syntaxMatch = msg.match(/SyntaxError: ([^\n]+)/);
|
|
70
|
+
return {
|
|
71
|
+
detail: syntaxMatch ? `Syntax Error: ${syntaxMatch[1]}` : "JavaScript syntax error",
|
|
72
|
+
suggestion: "Check your code for syntax errors",
|
|
73
|
+
category: "runtime",
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
// TypeError
|
|
78
|
+
{
|
|
79
|
+
name: "type-error",
|
|
80
|
+
match: (msg) => msg.includes("TypeError:"),
|
|
81
|
+
extract: (msg) => {
|
|
82
|
+
const typeMatch = msg.match(/TypeError: ([^\n]+)/);
|
|
83
|
+
return {
|
|
84
|
+
detail: typeMatch ? `Type Error: ${typeMatch[1]}` : "Type error in code",
|
|
85
|
+
category: "runtime",
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// ReferenceError (undefined variable)
|
|
90
|
+
{
|
|
91
|
+
name: "reference-error",
|
|
92
|
+
match: (msg) => msg.includes("ReferenceError:"),
|
|
93
|
+
extract: (msg) => {
|
|
94
|
+
const refMatch = msg.match(/ReferenceError: ([^\n]+)/);
|
|
95
|
+
return {
|
|
96
|
+
detail: refMatch ? `Reference Error: ${refMatch[1]}` : "Undefined variable error",
|
|
97
|
+
category: "runtime",
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
// npm install failures
|
|
102
|
+
{
|
|
103
|
+
name: "npm-install-failed",
|
|
104
|
+
match: (msg) => msg.includes("npm ERR!") || msg.includes("npm error"),
|
|
105
|
+
extract: (msg) => {
|
|
106
|
+
if (msg.includes("ERESOLVE")) {
|
|
107
|
+
return {
|
|
108
|
+
detail: "npm dependency resolution failed",
|
|
109
|
+
suggestion: "Try: npm install --legacy-peer-deps",
|
|
110
|
+
category: "build",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (msg.includes("ENOENT")) {
|
|
114
|
+
return {
|
|
115
|
+
detail: "npm package not found",
|
|
116
|
+
suggestion: "Check package name in package.json",
|
|
117
|
+
category: "build",
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
detail: "npm install failed",
|
|
122
|
+
suggestion: "Check package.json and try: npm install",
|
|
123
|
+
category: "build",
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
// Unhandled promise rejection
|
|
128
|
+
{
|
|
129
|
+
name: "unhandled-rejection",
|
|
130
|
+
match: (msg) => msg.includes("UnhandledPromiseRejection") || msg.includes("unhandled promise"),
|
|
131
|
+
extract: () => ({
|
|
132
|
+
detail: "Unhandled Promise rejection",
|
|
133
|
+
suggestion: "Add error handling to async operations",
|
|
134
|
+
category: "runtime",
|
|
135
|
+
}),
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
export const nodejsAnalyzer = {
|
|
139
|
+
runtime: "nodejs",
|
|
140
|
+
displayName: "Node.js",
|
|
141
|
+
patterns: nodejsPatterns,
|
|
142
|
+
};
|
|
143
|
+
// Also export for TypeScript runtime (same patterns)
|
|
144
|
+
export const typescriptAnalyzer = {
|
|
145
|
+
runtime: "typescript",
|
|
146
|
+
displayName: "TypeScript",
|
|
147
|
+
patterns: nodejsPatterns,
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=nodejs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodejs.js","sourceRoot":"","sources":["../../../src/lib/error-analyzers/nodejs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,cAAc,GAAmB;IACrC,6CAA6C;IAC7C;QACE,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CACb,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACtB,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACf,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAChD,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAEhE,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,kBAAkB,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAClD,CAAC;YACD,IAAI,SAAS,EAAE,CAA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