@htekdev/actions-debugger 1.0.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.
- package/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/db/loader.d.ts +12 -0
- package/dist/db/loader.d.ts.map +1 -0
- package/dist/db/loader.js +76 -0
- package/dist/db/loader.js.map +1 -0
- package/dist/db/search.d.ts +19 -0
- package/dist/db/search.d.ts.map +1 -0
- package/dist/db/search.js +123 -0
- package/dist/db/search.js.map +1 -0
- package/dist/db/types.d.ts +61 -0
- package/dist/db/types.d.ts.map +1 -0
- package/dist/db/types.js +5 -0
- package/dist/db/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +164 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/diagnose-workflow.d.ts +13 -0
- package/dist/tools/diagnose-workflow.d.ts.map +1 -0
- package/dist/tools/diagnose-workflow.js +53 -0
- package/dist/tools/diagnose-workflow.js.map +1 -0
- package/dist/tools/list-categories.d.ts +13 -0
- package/dist/tools/list-categories.d.ts.map +1 -0
- package/dist/tools/list-categories.js +51 -0
- package/dist/tools/list-categories.js.map +1 -0
- package/dist/tools/lookup-error.d.ts +18 -0
- package/dist/tools/lookup-error.d.ts.map +1 -0
- package/dist/tools/lookup-error.js +67 -0
- package/dist/tools/lookup-error.js.map +1 -0
- package/dist/tools/search-errors.d.ts +17 -0
- package/dist/tools/search-errors.d.ts.map +1 -0
- package/dist/tools/search-errors.js +33 -0
- package/dist/tools/search-errors.js.map +1 -0
- package/dist/tools/suggest-fix.d.ts +13 -0
- package/dist/tools/suggest-fix.d.ts.map +1 -0
- package/dist/tools/suggest-fix.js +62 -0
- package/dist/tools/suggest-fix.js.map +1 -0
- package/dist/utils/pattern-matcher.d.ts +15 -0
- package/dist/utils/pattern-matcher.d.ts.map +1 -0
- package/dist/utils/pattern-matcher.js +50 -0
- package/dist/utils/pattern-matcher.js.map +1 -0
- package/dist/utils/yaml-parser.d.ts +10 -0
- package/dist/utils/yaml-parser.d.ts.map +1 -0
- package/dist/utils/yaml-parser.js +142 -0
- package/dist/utils/yaml-parser.js.map +1 -0
- package/errors/_schema.json +89 -0
- package/errors/caching-artifacts/cache-miss.yml +56 -0
- package/errors/caching-artifacts/upload-artifact-v4-breaking.yml +67 -0
- package/errors/concurrency-timing/jobs-cancelled-unexpectedly.yml +60 -0
- package/errors/known-unsolved/no-step-retry.yml +53 -0
- package/errors/permissions-auth/github-token-403.yml +64 -0
- package/errors/permissions-auth/oidc-aws-failure.yml +85 -0
- package/errors/runner-environment/disk-space.yml +57 -0
- package/errors/runner-environment/node-runtime-deprecation.yml +56 -0
- package/errors/silent-failures/github-token-no-trigger.yml +57 -0
- package/errors/silent-failures/scheduled-workflow-disabled.yml +59 -0
- package/errors/triggers/cron-schedule-late.yml +59 -0
- package/errors/triggers/workflow-not-triggering.yml +60 -0
- package/errors/yaml-syntax/if-always-true.yml +52 -0
- package/errors/yaml-syntax/secrets-in-if.yml +55 -0
- package/errors/yaml-syntax/unexpected-yaml-key.yml +69 -0
- package/package.json +67 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server setup — registers all tools with the MCP server.
|
|
3
|
+
*/
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { lookupError, formatLookupResult } from "./tools/lookup-error.js";
|
|
6
|
+
import { diagnoseWorkflow, formatDiagnosticResult } from "./tools/diagnose-workflow.js";
|
|
7
|
+
import { suggestFix, formatSuggestResult } from "./tools/suggest-fix.js";
|
|
8
|
+
import { listCategories, formatCategoryList } from "./tools/list-categories.js";
|
|
9
|
+
import { searchErrors, formatSearchResult } from "./tools/search-errors.js";
|
|
10
|
+
const CATEGORIES = [
|
|
11
|
+
"yaml-syntax",
|
|
12
|
+
"silent-failures",
|
|
13
|
+
"runner-environment",
|
|
14
|
+
"permissions-auth",
|
|
15
|
+
"caching-artifacts",
|
|
16
|
+
"triggers",
|
|
17
|
+
"concurrency-timing",
|
|
18
|
+
"known-unsolved",
|
|
19
|
+
];
|
|
20
|
+
const TOOLS = [
|
|
21
|
+
{
|
|
22
|
+
name: "lookup_error",
|
|
23
|
+
description: "Match a GitHub Actions error message against the known error database. Returns matching errors with root cause and fix.",
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: "object",
|
|
26
|
+
required: ["error_message"],
|
|
27
|
+
properties: {
|
|
28
|
+
error_message: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "The error message from GitHub Actions logs",
|
|
31
|
+
},
|
|
32
|
+
max_results: {
|
|
33
|
+
type: "number",
|
|
34
|
+
description: "Maximum results to return (default: 3)",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "diagnose_workflow",
|
|
41
|
+
description: "Analyze a GitHub Actions workflow YAML for common issues. Returns a list of potential problems with severity and fixes.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
required: ["workflow_yaml"],
|
|
45
|
+
properties: {
|
|
46
|
+
workflow_yaml: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "The workflow YAML content to analyze",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "suggest_fix",
|
|
55
|
+
description: "Given error context (error message, workflow snippet, runner OS), suggest the most likely fix with code examples.",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
required: ["error_context"],
|
|
59
|
+
properties: {
|
|
60
|
+
error_context: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Description of the problem — error message, what you're trying to do, runner OS, etc.",
|
|
63
|
+
},
|
|
64
|
+
category: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Error category to narrow search (optional)",
|
|
67
|
+
enum: CATEGORIES,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "list_categories",
|
|
74
|
+
description: "List all error categories with error counts and descriptions.",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "search_errors",
|
|
82
|
+
description: "Search the error database by keyword, tag, or category.",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
required: ["query"],
|
|
86
|
+
properties: {
|
|
87
|
+
query: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "Search query — matches against title, root_cause, fix, tags",
|
|
90
|
+
},
|
|
91
|
+
category: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "Filter by category (optional)",
|
|
94
|
+
enum: CATEGORIES,
|
|
95
|
+
},
|
|
96
|
+
severity: {
|
|
97
|
+
type: "string",
|
|
98
|
+
description: "Filter by severity (optional)",
|
|
99
|
+
enum: ["error", "warning", "silent-failure", "limitation"],
|
|
100
|
+
},
|
|
101
|
+
max_results: {
|
|
102
|
+
type: "number",
|
|
103
|
+
description: "Maximum results to return (default: 10)",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
/**
|
|
110
|
+
* Register all tools with the MCP server.
|
|
111
|
+
*/
|
|
112
|
+
export function registerTools(server, db) {
|
|
113
|
+
// List available tools
|
|
114
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
115
|
+
tools: TOOLS,
|
|
116
|
+
}));
|
|
117
|
+
// Handle tool calls
|
|
118
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
119
|
+
const { name, arguments: args } = request.params;
|
|
120
|
+
switch (name) {
|
|
121
|
+
case "lookup_error": {
|
|
122
|
+
const { error_message, max_results } = args;
|
|
123
|
+
const results = lookupError(db, error_message, max_results ?? 3);
|
|
124
|
+
return {
|
|
125
|
+
content: [{ type: "text", text: formatLookupResult(results) }],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
case "diagnose_workflow": {
|
|
129
|
+
const { workflow_yaml } = args;
|
|
130
|
+
const findings = diagnoseWorkflow(db, workflow_yaml);
|
|
131
|
+
return {
|
|
132
|
+
content: [{ type: "text", text: formatDiagnosticResult(findings) }],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
case "suggest_fix": {
|
|
136
|
+
const { error_context, category } = args;
|
|
137
|
+
const results = suggestFix(db, error_context, category);
|
|
138
|
+
return {
|
|
139
|
+
content: [{ type: "text", text: formatSuggestResult(results) }],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
case "list_categories": {
|
|
143
|
+
const categories = listCategories(db);
|
|
144
|
+
return {
|
|
145
|
+
content: [{ type: "text", text: formatCategoryList(categories) }],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
case "search_errors": {
|
|
149
|
+
const { query, category, severity, max_results } = args;
|
|
150
|
+
const results = searchErrors(db, query, {
|
|
151
|
+
category,
|
|
152
|
+
severity,
|
|
153
|
+
maxResults: max_results ?? 10,
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
content: [{ type: "text", text: formatSearchResult(results) }],
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
default:
|
|
160
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,qBAAqB,EACrB,s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M,EAAE,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;iBAClE,CAAC;YACJ,CAAC;YAED,KAAK,eAAe,CAAC,CAAC,CAAC;gBACrB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAKlD,CAAC;gBACF,MAAM,OAAO,GAAG,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE;oBACtC,QAAQ;oBACR,QAAQ;oBACR,UAAU,EAAE,WAAW,IAAI,EAAE;iBAC9B,CAAC,CAAC;gBACH,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;iBAC/D,CAAC;YACJ,CAAC;YAED;gBACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diagnose_workflow tool — analyze workflow YAML for common mistakes.
|
|
3
|
+
*/
|
|
4
|
+
import type { ErrorDatabase, DiagnosticFinding } from "../db/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Diagnose a workflow YAML for common issues.
|
|
7
|
+
*/
|
|
8
|
+
export declare function diagnoseWorkflow(db: ErrorDatabase, workflowYaml: string): DiagnosticFinding[];
|
|
9
|
+
/**
|
|
10
|
+
* Format diagnostic findings as a human-readable string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatDiagnosticResult(findings: DiagnosticFinding[]): string;
|
|
13
|
+
//# sourceMappingURL=diagnose-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnose-workflow.d.ts","sourceRoot":"","sources":["../../src/tools/diagnose-workflow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGvE;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,aAAa,EACjB,YAAY,EAAE,MAAM,GACnB,iBAAiB,EAAE,CAErB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,CA4C5E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diagnose_workflow tool — analyze workflow YAML for common mistakes.
|
|
3
|
+
*/
|
|
4
|
+
import { analyzeWorkflow } from "../utils/yaml-parser.js";
|
|
5
|
+
/**
|
|
6
|
+
* Diagnose a workflow YAML for common issues.
|
|
7
|
+
*/
|
|
8
|
+
export function diagnoseWorkflow(db, workflowYaml) {
|
|
9
|
+
return analyzeWorkflow(workflowYaml);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Format diagnostic findings as a human-readable string.
|
|
13
|
+
*/
|
|
14
|
+
export function formatDiagnosticResult(findings) {
|
|
15
|
+
if (findings.length === 0) {
|
|
16
|
+
return "✅ No issues found. Workflow looks good!";
|
|
17
|
+
}
|
|
18
|
+
const grouped = {
|
|
19
|
+
critical: [],
|
|
20
|
+
high: [],
|
|
21
|
+
medium: [],
|
|
22
|
+
low: [],
|
|
23
|
+
};
|
|
24
|
+
for (const f of findings) {
|
|
25
|
+
grouped[f.severity].push(f);
|
|
26
|
+
}
|
|
27
|
+
const lines = [
|
|
28
|
+
`## Workflow Analysis — ${findings.length} issue(s) found`,
|
|
29
|
+
"",
|
|
30
|
+
];
|
|
31
|
+
const severityLabels = {
|
|
32
|
+
critical: "🔴 Critical",
|
|
33
|
+
high: "🟠 High",
|
|
34
|
+
medium: "🟡 Medium",
|
|
35
|
+
low: "🔵 Low",
|
|
36
|
+
};
|
|
37
|
+
for (const [sev, label] of Object.entries(severityLabels)) {
|
|
38
|
+
const items = grouped[sev];
|
|
39
|
+
if (items.length === 0)
|
|
40
|
+
continue;
|
|
41
|
+
lines.push(`### ${label} (${items.length})`);
|
|
42
|
+
for (const f of items) {
|
|
43
|
+
lines.push(`- **${f.message}**`);
|
|
44
|
+
lines.push(` Fix: ${f.fix}`);
|
|
45
|
+
if (f.fix_code) {
|
|
46
|
+
lines.push(` \`\`\`\n ${f.fix_code}\n \`\`\``);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
lines.push("");
|
|
50
|
+
}
|
|
51
|
+
return lines.join("\n");
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=diagnose-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnose-workflow.js","sourceRoot":"","sources":["../../src/tools/diagnose-workflow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,EAAiB,EACjB,YAAoB;IAEpB,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAA6B;IAClE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,yCAAyC,CAAC;IACnD,CAAC;IAED,MAAM,OAAO,GAAwC;QACnD,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,EAAE;KACR,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,KAAK,GAAa;QACtB,0BAA0B,QAAQ,CAAC,MAAM,iBAAiB;QAC1D,EAAE;KACH,CAAC;IAEF,MAAM,cAAc,GAA2B;QAC7C,QAAQ,EAAE,aAAa;QACvB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,WAAW;QACnB,GAAG,EAAE,QAAQ;KACd,CAAC;IAEF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEjC,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YAC9B,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,YAAY,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_categories tool — list all error categories with counts.
|
|
3
|
+
*/
|
|
4
|
+
import type { ErrorDatabase, CategoryInfo } from "../db/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* List all categories with error counts and severity breakdown.
|
|
7
|
+
*/
|
|
8
|
+
export declare function listCategories(db: ErrorDatabase): CategoryInfo[];
|
|
9
|
+
/**
|
|
10
|
+
* Format category list as human-readable string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatCategoryList(categories: CategoryInfo[]): string;
|
|
13
|
+
//# sourceMappingURL=list-categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-categories.d.ts","sourceRoot":"","sources":["../../src/tools/list-categories.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgC,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhG;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,YAAY,EAAE,CAqBhE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,MAAM,CAuBrE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_categories tool — list all error categories with counts.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* List all categories with error counts and severity breakdown.
|
|
6
|
+
*/
|
|
7
|
+
export function listCategories(db) {
|
|
8
|
+
const categories = [];
|
|
9
|
+
for (const [name, entries] of db.categories) {
|
|
10
|
+
const severities = {
|
|
11
|
+
error: 0,
|
|
12
|
+
warning: 0,
|
|
13
|
+
"silent-failure": 0,
|
|
14
|
+
limitation: 0,
|
|
15
|
+
};
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
severities[entry.severity]++;
|
|
18
|
+
}
|
|
19
|
+
categories.push({ name, count: entries.length, severities });
|
|
20
|
+
}
|
|
21
|
+
// Sort by count descending
|
|
22
|
+
categories.sort((a, b) => b.count - a.count);
|
|
23
|
+
return categories;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Format category list as human-readable string.
|
|
27
|
+
*/
|
|
28
|
+
export function formatCategoryList(categories) {
|
|
29
|
+
const totalErrors = categories.reduce((sum, c) => sum + c.count, 0);
|
|
30
|
+
const lines = [
|
|
31
|
+
`## Error Categories (${totalErrors} total errors)`,
|
|
32
|
+
"",
|
|
33
|
+
"| Category | Count | Severities |",
|
|
34
|
+
"|----------|-------|------------|",
|
|
35
|
+
];
|
|
36
|
+
for (const cat of categories) {
|
|
37
|
+
const sevParts = [];
|
|
38
|
+
if (cat.severities.error)
|
|
39
|
+
sevParts.push(`${cat.severities.error} error`);
|
|
40
|
+
if (cat.severities.warning)
|
|
41
|
+
sevParts.push(`${cat.severities.warning} warning`);
|
|
42
|
+
if (cat.severities["silent-failure"])
|
|
43
|
+
sevParts.push(`${cat.severities["silent-failure"]} silent`);
|
|
44
|
+
if (cat.severities.limitation)
|
|
45
|
+
sevParts.push(`${cat.severities.limitation} limitation`);
|
|
46
|
+
lines.push(`| \`${cat.name}\` | ${cat.count} | ${sevParts.join(", ")} |`);
|
|
47
|
+
}
|
|
48
|
+
lines.push("", `*Source: [GitHub Actions Debugging Guide](https://htek.dev/articles/github-actions-debugging-guide)*`);
|
|
49
|
+
return lines.join("\n");
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=list-categories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-categories.js","sourceRoot":"","sources":["../../src/tools/list-categories.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAiB;IAC9C,MAAM,UAAU,GAAmB,EAAE,CAAC;IAEtC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;QAC5C,MAAM,UAAU,GAAkC;YAChD,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,CAAC;YACV,gBAAgB,EAAE,CAAC;YACnB,UAAU,EAAE,CAAC;SACd,CAAC;QAEF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,2BAA2B;IAC3B,UAAU,CAAC,IAAI,CAAC,CAA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EAAE,EAAE,sGAAsG,CAAC,CAAC;IAEvH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lookup_error tool — match error messages against the known error database.
|
|
3
|
+
*/
|
|
4
|
+
import type { ErrorDatabase, ErrorEntry } from "../db/types.js";
|
|
5
|
+
export interface LookupErrorInput {
|
|
6
|
+
error_message: string;
|
|
7
|
+
max_results?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Look up an error message in the database.
|
|
11
|
+
* Returns matching errors with root cause and fix.
|
|
12
|
+
*/
|
|
13
|
+
export declare function lookupError(db: ErrorDatabase, errorMessage: string, maxResults?: number): ErrorEntry[];
|
|
14
|
+
/**
|
|
15
|
+
* Format lookup results as a human-readable MCP response.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatLookupResult(results: ErrorEntry[]): string;
|
|
18
|
+
//# sourceMappingURL=lookup-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup-error.d.ts","sourceRoot":"","sources":["../../src/tools/lookup-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG9E,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,aAAa,EACjB,YAAY,EAAE,MAAM,EACpB,UAAU,GAAE,MAAU,GACrB,UAAU,EAAE,CAGd;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAwDhE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lookup_error tool — match error messages against the known error database.
|
|
3
|
+
*/
|
|
4
|
+
import { lookupByPattern } from "../db/search.js";
|
|
5
|
+
/**
|
|
6
|
+
* Look up an error message in the database.
|
|
7
|
+
* Returns matching errors with root cause and fix.
|
|
8
|
+
*/
|
|
9
|
+
export function lookupError(db, errorMessage, maxResults = 3) {
|
|
10
|
+
const results = lookupByPattern(db, errorMessage, maxResults);
|
|
11
|
+
return results.map(r => r.entry);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Format lookup results as a human-readable MCP response.
|
|
15
|
+
*/
|
|
16
|
+
export function formatLookupResult(results) {
|
|
17
|
+
if (results.length === 0) {
|
|
18
|
+
return [
|
|
19
|
+
"No matching errors found in the database.",
|
|
20
|
+
"",
|
|
21
|
+
"**Suggestions:**",
|
|
22
|
+
"1. Enable debug logging: set `ACTIONS_STEP_DEBUG` secret to `true`",
|
|
23
|
+
"2. Run `actionlint` on your workflow files",
|
|
24
|
+
"3. Check the full guide: https://htek.dev/articles/github-actions-debugging-guide",
|
|
25
|
+
].join("\n");
|
|
26
|
+
}
|
|
27
|
+
return results
|
|
28
|
+
.map((entry, i) => {
|
|
29
|
+
const lines = [
|
|
30
|
+
`## ${i > 0 ? `Match ${i + 1}: ` : ""}${entry.title}`,
|
|
31
|
+
"",
|
|
32
|
+
`**Category:** ${entry.category} | **Severity:** ${entry.severity}`,
|
|
33
|
+
"",
|
|
34
|
+
`**Root Cause:**`,
|
|
35
|
+
entry.root_cause.trim(),
|
|
36
|
+
"",
|
|
37
|
+
`**Fix:**`,
|
|
38
|
+
entry.fix.trim(),
|
|
39
|
+
];
|
|
40
|
+
if (entry.fix_code?.length) {
|
|
41
|
+
lines.push("");
|
|
42
|
+
for (const fc of entry.fix_code) {
|
|
43
|
+
lines.push(`\`\`\`${fc.language}`);
|
|
44
|
+
lines.push(fc.code.trim());
|
|
45
|
+
lines.push("```");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (entry.prevention?.length) {
|
|
49
|
+
lines.push("", "**Prevention:**");
|
|
50
|
+
for (const p of entry.prevention) {
|
|
51
|
+
lines.push(`- ${p}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (entry.docs?.length) {
|
|
55
|
+
lines.push("", "**Docs:**");
|
|
56
|
+
for (const d of entry.docs) {
|
|
57
|
+
lines.push(`- [${d.label}](${d.url})`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (entry.source?.article) {
|
|
61
|
+
lines.push("", `**Source:** [Full Guide](${entry.source.article})`);
|
|
62
|
+
}
|
|
63
|
+
return lines.join("\n");
|
|
64
|
+
})
|
|
65
|
+
.join("\n\n---\n\n");
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=lookup-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup-error.js","sourceRoot":"","sources":["../../src/tools/lookup-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAOlD;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,EAAiB,EACjB,YAAoB,EACpB,aAAqB,CAAC;IAEtB,MAAM,OAAO,GAAG,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAqB;IACtD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;YACL,2CAA2C;YAC3C,EAAE;YACF,kBAAkB;YAClB,oEAAoE;YACpE,4CAA4C;YAC5C,mFAAmF;SACpF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAChB,MAAM,KAAK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,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,4BAA4B,KAAK,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;QACtE,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC;SACD,IAAI,CAAC,aAAa,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* search_errors tool — full-text search across the error database.
|
|
3
|
+
*/
|
|
4
|
+
import type { ErrorDatabase, ErrorEntry } from "../db/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Search the error database by keyword, tag, or category.
|
|
7
|
+
*/
|
|
8
|
+
export declare function searchErrors(db: ErrorDatabase, query: string, options?: {
|
|
9
|
+
category?: string;
|
|
10
|
+
severity?: string;
|
|
11
|
+
maxResults?: number;
|
|
12
|
+
}): ErrorEntry[];
|
|
13
|
+
/**
|
|
14
|
+
* Format search results as human-readable string.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatSearchResult(results: ErrorEntry[]): string;
|
|
17
|
+
//# sourceMappingURL=search-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-errors.d.ts","sourceRoot":"","sources":["../../src/tools/search-errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGhE;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,aAAa,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,UAAU,EAAE,CAGd;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAqBhE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* search_errors tool — full-text search across the error database.
|
|
3
|
+
*/
|
|
4
|
+
import { searchByKeyword } from "../db/search.js";
|
|
5
|
+
/**
|
|
6
|
+
* Search the error database by keyword, tag, or category.
|
|
7
|
+
*/
|
|
8
|
+
export function searchErrors(db, query, options) {
|
|
9
|
+
const results = searchByKeyword(db, query, options);
|
|
10
|
+
return results.map(r => r.entry);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Format search results as human-readable string.
|
|
14
|
+
*/
|
|
15
|
+
export function formatSearchResult(results) {
|
|
16
|
+
if (results.length === 0) {
|
|
17
|
+
return "No results found. Try a different search query or browse categories with `list_categories`.";
|
|
18
|
+
}
|
|
19
|
+
const lines = [
|
|
20
|
+
`## Search Results (${results.length} match${results.length === 1 ? "" : "es"})`,
|
|
21
|
+
"",
|
|
22
|
+
];
|
|
23
|
+
for (const entry of results) {
|
|
24
|
+
lines.push(`### ${entry.title}`);
|
|
25
|
+
lines.push(`**ID:** ${entry.id} | **Category:** ${entry.category} | **Severity:** ${entry.severity}`);
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push(entry.root_cause.trim().split("\n")[0] + "...");
|
|
28
|
+
lines.push("");
|
|
29
|
+
}
|
|
30
|
+
lines.push(`*Source: [Full Guide](https://htek.dev/articles/github-actions-debugging-guide)*`);
|
|
31
|
+
return lines.join("\n");
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=search-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-errors.js","sourceRoot":"","sources":["../../src/tools/search-errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAA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
+
/**
|
|
2
|
+
* suggest_fix tool — contextual fix suggestions.
|
|
3
|
+
*/
|
|
4
|
+
import type { ErrorDatabase, ErrorEntry } from "../db/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Suggest a fix given broader error context.
|
|
7
|
+
*/
|
|
8
|
+
export declare function suggestFix(db: ErrorDatabase, errorContext: string, category?: string): ErrorEntry[];
|
|
9
|
+
/**
|
|
10
|
+
* Format suggest_fix results.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatSuggestResult(results: ErrorEntry[]): string;
|
|
13
|
+
//# sourceMappingURL=suggest-fix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest-fix.d.ts","sourceRoot":"","sources":["../../src/tools/suggest-fix.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGhE;;GAEG;AACH,wBAAgB,UAAU,CACxB,EAAE,EAAE,aAAa,EACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,MAAM,GAChB,UAAU,EAAE,CAUd;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CA8CjE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* suggest_fix tool — contextual fix suggestions.
|
|
3
|
+
*/
|
|
4
|
+
import { lookupByPattern, searchByKeyword } from "../db/search.js";
|
|
5
|
+
/**
|
|
6
|
+
* Suggest a fix given broader error context.
|
|
7
|
+
*/
|
|
8
|
+
export function suggestFix(db, errorContext, category) {
|
|
9
|
+
// Try regex matching first
|
|
10
|
+
let results = lookupByPattern(db, errorContext, 5);
|
|
11
|
+
// If no regex matches, try keyword search
|
|
12
|
+
if (results.length === 0) {
|
|
13
|
+
results = searchByKeyword(db, errorContext, { category, maxResults: 5 });
|
|
14
|
+
}
|
|
15
|
+
return results.map(r => r.entry);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Format suggest_fix results.
|
|
19
|
+
*/
|
|
20
|
+
export function formatSuggestResult(results) {
|
|
21
|
+
if (results.length === 0) {
|
|
22
|
+
return [
|
|
23
|
+
"No matching errors found for this context.",
|
|
24
|
+
"",
|
|
25
|
+
"**Try:**",
|
|
26
|
+
"1. Paste the exact error message for a more precise match",
|
|
27
|
+
"2. Search by category: `search_errors` with a category filter",
|
|
28
|
+
"3. Check the full guide: https://htek.dev/articles/github-actions-debugging-guide",
|
|
29
|
+
].join("\n");
|
|
30
|
+
}
|
|
31
|
+
const best = results[0];
|
|
32
|
+
const lines = [
|
|
33
|
+
`## Suggested Fix: ${best.title}`,
|
|
34
|
+
"",
|
|
35
|
+
`**Category:** ${best.category} | **Severity:** ${best.severity}`,
|
|
36
|
+
"",
|
|
37
|
+
`**Root Cause:**`,
|
|
38
|
+
best.root_cause.trim(),
|
|
39
|
+
"",
|
|
40
|
+
`**Fix:**`,
|
|
41
|
+
best.fix.trim(),
|
|
42
|
+
];
|
|
43
|
+
if (best.fix_code?.length) {
|
|
44
|
+
lines.push("");
|
|
45
|
+
for (const fc of best.fix_code) {
|
|
46
|
+
lines.push(`\`\`\`${fc.language}`);
|
|
47
|
+
lines.push(fc.code.trim());
|
|
48
|
+
lines.push("```");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (results.length > 1) {
|
|
52
|
+
lines.push("", "**Other possible matches:**");
|
|
53
|
+
for (const entry of results.slice(1)) {
|
|
54
|
+
lines.push(`- ${entry.title} (${entry.category})`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (best.source?.article) {
|
|
58
|
+
lines.push("", `**Source:** [Full Guide](${best.source.article})`);
|
|
59
|
+
}
|
|
60
|
+
return lines.join("\n");
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=suggest-fix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sugg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,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,6BAA6B,CAAC,CAAC;QAC9C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,4BAA4B,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex pattern safety utilities.
|
|
3
|
+
* Validates that user-contributed regex patterns are safe to execute.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if a regex pattern is safe to use at runtime.
|
|
7
|
+
* Returns true if safe, false if potentially dangerous.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRegexSafe(pattern: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Safely execute a regex match with timeout protection.
|
|
12
|
+
* Truncates input to prevent unbounded matching.
|
|
13
|
+
*/
|
|
14
|
+
export declare function safeMatch(pattern: string, flags: string, input: string, maxInputLength?: number): boolean;
|
|
15
|
+
//# sourceMappingURL=pattern-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-matcher.d.ts","sourceRoot":"","sources":["../../src/utils/pattern-matcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAgBpD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,MAAe,GAC9B,OAAO,CAST"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex pattern safety utilities.
|
|
3
|
+
* Validates that user-contributed regex patterns are safe to execute.
|
|
4
|
+
*/
|
|
5
|
+
/** Maximum allowed regex source length */
|
|
6
|
+
const MAX_REGEX_LENGTH = 500;
|
|
7
|
+
/** Patterns that suggest catastrophic backtracking */
|
|
8
|
+
const DANGEROUS_PATTERNS = [
|
|
9
|
+
/\(\.\*\)\+/, // (.*)+
|
|
10
|
+
/\(\.\+\)\+/, // (.+)+
|
|
11
|
+
/\(\[^\\]\]\*\)\+/, // ([^x]*)+
|
|
12
|
+
/\(\.\{[^}]+\}\)\+/, // (.{n})+
|
|
13
|
+
/\(\.\*\)\{/, // (.*){
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Check if a regex pattern is safe to use at runtime.
|
|
17
|
+
* Returns true if safe, false if potentially dangerous.
|
|
18
|
+
*/
|
|
19
|
+
export function isRegexSafe(pattern) {
|
|
20
|
+
if (pattern.length > MAX_REGEX_LENGTH)
|
|
21
|
+
return false;
|
|
22
|
+
// Try to compile it
|
|
23
|
+
try {
|
|
24
|
+
new RegExp(pattern);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Check for known dangerous patterns
|
|
30
|
+
for (const dangerous of DANGEROUS_PATTERNS) {
|
|
31
|
+
if (dangerous.test(pattern))
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Safely execute a regex match with timeout protection.
|
|
38
|
+
* Truncates input to prevent unbounded matching.
|
|
39
|
+
*/
|
|
40
|
+
export function safeMatch(pattern, flags, input, maxInputLength = 10_000) {
|
|
41
|
+
const truncated = input.slice(0, maxInputLength);
|
|
42
|
+
try {
|
|
43
|
+
const re = new RegExp(pattern, flags);
|
|
44
|
+
return re.test(truncated);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=pattern-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern-matcher.js","sourceRoot":"","sources":["../../src/utils/pattern-matcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0CAA0C;AAC1C,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,sDAAsD;AACtD,MAAM,kBAAkB,GAAG;IACzB,YAAY,EAAY,QAAQ;IAChC,YAAY,EAAY,QAAQ;IAChC,kBAAkB,EAAM,WAAW;IACnC,mBAAmB,EAAK,UAAU;IAClC,YAAY,EAAY,QAAQ;CACjC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,IAAI,OAAO,CAAC,MAAM,GAAG,gBAAgB;QAAE,OAAO,KAAK,CAAC;IAEpD,oBAAoB;IACpB,IAAI,CAAC;QACH,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qCAAqC;IACrC,KAAK,MAAM,SAAS,IAAI,kBAAkB,EAAE,CAAC;QAC3C,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;IAC5C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,OAAe,EACf,KAAa,EACb,KAAa,EACb,iBAAyB,MAAM;IAE/B,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IAEjD,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|