accessflow-mcp-server 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/TOOL_REFERENCE.md +126 -0
- package/bin/flow-mcp +4 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +95 -0
- package/build/index.js.map +1 -0
- package/build/prompts/formatUrgentIssues.d.ts +4 -0
- package/build/prompts/formatUrgentIssues.d.ts.map +1 -0
- package/build/prompts/formatUrgentIssues.js +78 -0
- package/build/prompts/formatUrgentIssues.js.map +1 -0
- package/build/prompts/index.d.ts +4 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +12 -0
- package/build/prompts/index.js.map +1 -0
- package/build/prompts/types.d.ts +22 -0
- package/build/prompts/types.d.ts.map +1 -0
- package/build/prompts/types.js +2 -0
- package/build/prompts/types.js.map +1 -0
- package/build/rules.json +4591 -0
- package/build/services/accessflow.d.ts +6 -0
- package/build/services/accessflow.d.ts.map +1 -0
- package/build/services/accessflow.js +8 -0
- package/build/services/accessflow.js.map +1 -0
- package/build/tools/getIssueRemediation.d.ts +4 -0
- package/build/tools/getIssueRemediation.d.ts.map +1 -0
- package/build/tools/getIssueRemediation.js +165 -0
- package/build/tools/getIssueRemediation.js.map +1 -0
- package/build/tools/getMostUrgentIssues.d.ts +4 -0
- package/build/tools/getMostUrgentIssues.d.ts.map +1 -0
- package/build/tools/getMostUrgentIssues.js +106 -0
- package/build/tools/getMostUrgentIssues.js.map +1 -0
- package/build/tools/index.d.ts +9 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +19 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/types.d.ts +19 -0
- package/build/tools/types.d.ts.map +1 -0
- package/build/tools/types.js +2 -0
- package/build/tools/types.js.map +1 -0
- package/build/utils/config.d.ts +8 -0
- package/build/utils/config.d.ts.map +1 -0
- package/build/utils/config.js +26 -0
- package/build/utils/config.js.map +1 -0
- package/build/utils/database.d.ts +13 -0
- package/build/utils/database.d.ts.map +1 -0
- package/build/utils/database.js +64 -0
- package/build/utils/database.js.map +1 -0
- package/build/utils/domain.d.ts +2 -0
- package/build/utils/domain.d.ts.map +1 -0
- package/build/utils/domain.js +11 -0
- package/build/utils/domain.js.map +1 -0
- package/build/utils/logger.d.ts +18 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +51 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/responses.d.ts +19 -0
- package/build/utils/responses.d.ts.map +1 -0
- package/build/utils/responses.js +41 -0
- package/build/utils/responses.js.map +1 -0
- package/build/utils/validation.d.ts +7 -0
- package/build/utils/validation.d.ts.map +1 -0
- package/build/utils/validation.js +47 -0
- package/build/utils/validation.js.map +1 -0
- package/mcp-config.json +11 -0
- package/package.json +33 -0
- package/src/index.ts +125 -0
- package/src/rules.json +4591 -0
- package/src/services/accessflow.ts +9 -0
- package/src/tools/getIssueRemediation.ts +218 -0
- package/src/tools/getMostUrgentIssues.ts +144 -0
- package/src/tools/index.ts +33 -0
- package/src/tools/types.ts +20 -0
- package/src/utils/domain.ts +13 -0
- package/test.mjs +63 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# AccessFlow MCP Tools
|
|
2
|
+
|
|
3
|
+
Quick reference for MCP clien## Tool: `getMostUrgentIssues`
|
|
4
|
+
|
|
5
|
+
Get the 10 most critical accessibility issues prioritized by severity, then by site occurrences, then by page occurrences for the configured website.
|
|
6
|
+
|
|
7
|
+
**Parameters:** None (uses configured WEBSITE_ID)
|
|
8
|
+
|
|
9
|
+
**Prioritization Logic:**
|
|
10
|
+
|
|
11
|
+
1. **Primary**: Severity (EXTREME > HIGH > MEDIUM > LOW)
|
|
12
|
+
2. **Secondary**: Site occurrences (how many locations on the site)
|
|
13
|
+
3. **Tertiary**: Page occurrences (how many times on the current page)
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"tool": "getMostUrgentIssues",
|
|
20
|
+
"arguments": {}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Returns:** Prioritized list with issue IDs, severity levels, occurrence counts, and locations for the configured website.accessibility tools.
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
The MCP server requires these environment variables:
|
|
29
|
+
|
|
30
|
+
- `MONGO_URI`: MongoDB connection string
|
|
31
|
+
- `WEBSITE_ID`: The website ID to filter accessibility issues for
|
|
32
|
+
|
|
33
|
+
Example MCP configuration:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcp": {
|
|
38
|
+
"servers": {
|
|
39
|
+
"flow-mcp": {
|
|
40
|
+
"command": "node",
|
|
41
|
+
"args": ["/path/to/flow-mcp/build/index.js"],
|
|
42
|
+
"env": {
|
|
43
|
+
"MONGO_URI": "mongodb://localhost:27017/accessflow",
|
|
44
|
+
"WEBSITE_ID": "68790033a1951a20af80f22b"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Tool: `getIssueRemediation`
|
|
53
|
+
|
|
54
|
+
Get detailed fix guidance for a specific accessibility issue from the configured website.
|
|
55
|
+
|
|
56
|
+
**Parameters:**
|
|
57
|
+
|
|
58
|
+
- `issueDisplayName` (string, required): Issue ID from AccessFlow
|
|
59
|
+
|
|
60
|
+
**Example:**
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"tool": "getIssueRemediation",
|
|
65
|
+
"arguments": {
|
|
66
|
+
"issueDisplayName": "Untagged-Headings-276b188870"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Returns:** Remediation guide with WCAG references, code examples, and fix instructions. Returns an error if the issue doesn't belong to the configured website.
|
|
72
|
+
|
|
73
|
+
## Tool: `getMostUrgentIssues`
|
|
74
|
+
|
|
75
|
+
Get the 10 most critical accessibility issues prioritized by severity.
|
|
76
|
+
|
|
77
|
+
**Parameters:**
|
|
78
|
+
|
|
79
|
+
- `website_id` (string, required): The website ID to get issues for. Only issues from this specific website will be returned.
|
|
80
|
+
|
|
81
|
+
**Example:**
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"tool": "getMostUrgentIssues",
|
|
86
|
+
"arguments": {
|
|
87
|
+
"website_id": "68790033a1951a20af80f22b"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Returns:** Prioritized list with issue IDs, severity levels, and locations.
|
|
93
|
+
|
|
94
|
+
## Workflow
|
|
95
|
+
|
|
96
|
+
1. **Get priorities:** `getMostUrgentIssues` → See which issues need attention first (filtered to configured website)
|
|
97
|
+
2. **Get fix details:** `getIssueRemediation` with specific issue IDs → Get step-by-step remediation
|
|
98
|
+
3. **Fix in order:** Start with EXTREME severity, then HIGH → MEDIUM → LOW
|
|
99
|
+
|
|
100
|
+
## Getting Website ID
|
|
101
|
+
|
|
102
|
+
You can find your website ID using the flow-db-mcp tool:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"tool": "readDocuments",
|
|
107
|
+
"arguments": {
|
|
108
|
+
"collectionName": "websites",
|
|
109
|
+
"projection": { "_id": 1, "domain": 1, "name": 1 }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Severity Levels
|
|
115
|
+
|
|
116
|
+
- 🔴 **EXTREME** - Critical accessibility barriers
|
|
117
|
+
- 🟠**HIGH** - Significant usability issues
|
|
118
|
+
- 🟡 **MEDIUM** - Moderate accessibility concerns
|
|
119
|
+
- 🟢 **LOW** - Minor improvements needed
|
|
120
|
+
|
|
121
|
+
## Error Handling
|
|
122
|
+
|
|
123
|
+
- Invalid issue ID → Returns "Issue Not Found" message
|
|
124
|
+
- Website ID mismatch → Returns "Website Mismatch Error" message
|
|
125
|
+
- Database connection issues → Returns connection error
|
|
126
|
+
- Missing parameters → Returns parameter validation error
|
package/bin/flow-mcp
ADDED
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import rulesData from "./rules.json" with { type: "json" };
|
|
6
|
+
import { getToolDefinitions, getToolHandler } from "./tools/index.js";
|
|
7
|
+
import { sanitizeDomain } from "./utils/domain.js";
|
|
8
|
+
class AccessFlowMCPServer {
|
|
9
|
+
server;
|
|
10
|
+
environment;
|
|
11
|
+
domain;
|
|
12
|
+
apiKey;
|
|
13
|
+
rules = rulesData;
|
|
14
|
+
constructor() {
|
|
15
|
+
this.server = new Server({
|
|
16
|
+
name: "flow-mcp",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
}, {
|
|
19
|
+
capabilities: {
|
|
20
|
+
tools: {},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
this.environment = process.env.ENVIRONMENT || "accessflow.accessibe.com";
|
|
24
|
+
// Get DOMAIN Key from environment variable
|
|
25
|
+
this.domain = sanitizeDomain(process.env.DOMAIN || "");
|
|
26
|
+
if (!this.domain) {
|
|
27
|
+
console.error("DOMAIN environment variable is required");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
// Get API Key from environment variable
|
|
31
|
+
this.apiKey = process.env.API_KEY || "";
|
|
32
|
+
if (!this.apiKey) {
|
|
33
|
+
console.error("API_KEY environment variable is required");
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
this.setupToolHandlers();
|
|
37
|
+
}
|
|
38
|
+
setupToolHandlers() {
|
|
39
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
40
|
+
return {
|
|
41
|
+
tools: getToolDefinitions(),
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
45
|
+
const { name, arguments: args } = request.params;
|
|
46
|
+
try {
|
|
47
|
+
const handler = getToolHandler(name);
|
|
48
|
+
if (!handler) {
|
|
49
|
+
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
50
|
+
}
|
|
51
|
+
const headers = {
|
|
52
|
+
"x-api-key": this.apiKey,
|
|
53
|
+
"x-accessflow-domain": this.domain,
|
|
54
|
+
"Content-Type": "application/json",
|
|
55
|
+
};
|
|
56
|
+
if (this.environment.toLowerCase().includes("test")) {
|
|
57
|
+
const basicAuth = Buffer.from("test:acsb123").toString("base64");
|
|
58
|
+
headers["Authorization"] = `Basic ${basicAuth}`;
|
|
59
|
+
}
|
|
60
|
+
const context = {
|
|
61
|
+
rules: this.rules,
|
|
62
|
+
environment: this.environment,
|
|
63
|
+
apiKey: this.apiKey,
|
|
64
|
+
headers: headers,
|
|
65
|
+
};
|
|
66
|
+
return await handler(args || {}, context);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof McpError) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
+
throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async run() {
|
|
78
|
+
const transport = new StdioServerTransport();
|
|
79
|
+
await this.server.connect(transport);
|
|
80
|
+
console.error("AccessFlow MCP Server running on stdio");
|
|
81
|
+
// Handle graceful shutdown
|
|
82
|
+
process.on("SIGINT", async () => {
|
|
83
|
+
console.error("Shutting down AccessFlow MCP Server...");
|
|
84
|
+
process.exit(0);
|
|
85
|
+
});
|
|
86
|
+
process.on("SIGTERM", async () => {
|
|
87
|
+
console.error("Shutting down AccessFlow MCP Server...");
|
|
88
|
+
process.exit(0);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Start the server
|
|
93
|
+
const server = new AccessFlowMCPServer();
|
|
94
|
+
server.run().catch(console.error);
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,SAAS,MAAM,cAAc,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,mBAAmB;IACf,MAAM,CAAS;IACf,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,MAAM,CAAS;IACf,KAAK,GAAU,SAAS,CAAC;IAEjC;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CACtB;YACE,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,OAAO;SACjB,EACD;YACE,YAAY,EAAE;gBACZ,KAAK,EAAE,EAAE;aACV;SACF,CACF,CAAC;QAEF,IAAI,CAAC,WAAW,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AAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;YAC9B,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;YAC/B,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,mBAAmB;AACnB,MAAM,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;AACzC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatUrgentIssues.d.ts","sourceRoot":"","sources":["../../src/prompts/formatUrgentIssues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAkB,MAAM,YAAY,CAAC;AAE7E,eAAO,MAAM,4BAA4B,EAAE,gBAU1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,aAyEvC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const formatUrgentIssuesDefinition = {
|
|
2
|
+
name: "formatUrgentIssues",
|
|
3
|
+
description: "Format urgent accessibility issues JSON data into a well-structured markdown report",
|
|
4
|
+
arguments: [
|
|
5
|
+
{
|
|
6
|
+
name: "issuesData",
|
|
7
|
+
description: "JSON object containing urgent issues data from getMostUrgentIssues tool",
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
export const formatUrgentIssuesHandler = async (args) => {
|
|
13
|
+
const { issuesData } = args;
|
|
14
|
+
// The issuesData should be the direct JSON object from getMostUrgentIssues
|
|
15
|
+
const data = issuesData;
|
|
16
|
+
// Handle empty issues case
|
|
17
|
+
if (!data.issues || data.issues.length === 0) {
|
|
18
|
+
return {
|
|
19
|
+
description: "Format empty accessibility issues response",
|
|
20
|
+
messages: [
|
|
21
|
+
{
|
|
22
|
+
role: "user",
|
|
23
|
+
content: {
|
|
24
|
+
type: "text",
|
|
25
|
+
text: "Format this accessibility issues data into a user-friendly markdown report:\n\n" + JSON.stringify(data, null, 2),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
role: "assistant",
|
|
30
|
+
content: {
|
|
31
|
+
type: "text",
|
|
32
|
+
text: "**No Issues Found**\n\nNo accessibility issues found.",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Generate markdown formatting for issues
|
|
39
|
+
const limit = data.limit || data.showing;
|
|
40
|
+
let responseText = `# 🚨 Most Urgent Accessibility Issues (Top ${limit})\n\n`;
|
|
41
|
+
responseText += `Here are the ${limit} most urgent accessibility issues that need attention:\n\n`;
|
|
42
|
+
data.issues.forEach((issue) => {
|
|
43
|
+
responseText += `## ${issue.rank}. ${issue.severityEmoji} ${issue.displayName}\n\n`;
|
|
44
|
+
responseText += `- **Severity:** ${issue.severity}\n`;
|
|
45
|
+
responseText += `- **WCAG:** ${issue.wcagLevel} - ${issue.criteria}\n`;
|
|
46
|
+
responseText += `- **Site Occurrences:** ${issue.siteOccurrences} location(s)\n`;
|
|
47
|
+
responseText += `- **Page Occurrences:** ${issue.pageOccurrences} time(s)\n`;
|
|
48
|
+
responseText += `💡 *Use \`getIssueRemediation\` with issueDisplayName: "${issue.displayName}" for detailed fix guidance*\n\n`;
|
|
49
|
+
responseText += "---\n\n";
|
|
50
|
+
});
|
|
51
|
+
responseText += "## Next Steps\n\n";
|
|
52
|
+
responseText += "List to the user these issues with all the data for every one of them: severity, wcag, etc. For every issue, show the displayName to the user. After listing all the issues, suggest the user to get full issue remediation data. Do not fix the issues unless explicitly asked to fix.\n\n";
|
|
53
|
+
responseText += `**Total Issues Found:** ${data.totalIssues} | **Showing Top:** ${data.showing}`;
|
|
54
|
+
if (data.hasMore) {
|
|
55
|
+
responseText += ` | **Additional issues available - contact for full report**`;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
description: "Format urgent accessibility issues into markdown report",
|
|
59
|
+
messages: [
|
|
60
|
+
{
|
|
61
|
+
role: "user",
|
|
62
|
+
content: {
|
|
63
|
+
type: "text",
|
|
64
|
+
text: "Format this accessibility issues data into a user-friendly markdown report:\n\n" +
|
|
65
|
+
JSON.stringify(data, null, 2),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
role: "assistant",
|
|
70
|
+
content: {
|
|
71
|
+
type: "text",
|
|
72
|
+
text: responseText,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=formatUrgentIssues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatUrgentIssues.js","sourceRoot":"","sources":["../../src/prompts/formatUrgentIssues.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAqB;IAC5D,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,qFAAqF;IAClG,SAAS,EAAE;QACT;YACE,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAkB,KAAK,EAAE,IAAI,EAA2B,EAAE;IAC9F,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAE5B,2EAA2E;IAC3E,MAAM,IAAI,GAAG,UAAU,CAAC;IAExB,2BAA2B;IAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,C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I,CAAC,OAAO,EAAE,CAAC;IAEjG,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,YAAY,IAAI,8DAA8D,CAAC;IACjF,CAAC;IAED,OAAO;QACL,WAAW,EAAE,yDAAyD;QACtE,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,iFAAiF;wBACjF,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;iBACpC;aACF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,YAAY;iBACnB;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQ7D,wBAAgB,oBAAoB,IAAI,gBAAgB,EAAE,CAEzD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAExE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { formatUrgentIssuesDefinition, formatUrgentIssuesHandler, } from "./formatUrgentIssues.js";
|
|
2
|
+
const promptDefinitions = [formatUrgentIssuesDefinition];
|
|
3
|
+
const promptHandlers = {
|
|
4
|
+
formatUrgentIssues: formatUrgentIssuesHandler,
|
|
5
|
+
};
|
|
6
|
+
export function getPromptDefinitions() {
|
|
7
|
+
return promptDefinitions;
|
|
8
|
+
}
|
|
9
|
+
export function getPromptHandler(name) {
|
|
10
|
+
return promptHandlers[name];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AAGjC,MAAM,iBAAiB,GAAuB,CAAC,4BAA4B,CAAC,CAAC;AAE7E,MAAM,cAAc,GAAkC;IACpD,kBAAkB,EAAE,yBAAyB;CAC9C,CAAC;AAEF,MAAM,UAAU,oBAAoB;IAClC,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface PromptDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
arguments: Array<{
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export interface PromptMessage {
|
|
11
|
+
role: "user" | "assistant";
|
|
12
|
+
content: {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface PromptResponse {
|
|
18
|
+
description: string;
|
|
19
|
+
messages: PromptMessage[];
|
|
20
|
+
}
|
|
21
|
+
export type PromptHandler = (args: any) => Promise<PromptResponse>;
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":""}
|