@debugg-ai/debugg-ai-mcp 1.0.63 → 1.0.65
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/CHANGELOG.md +177 -0
- package/README.md +49 -37
- package/dist/config/index.js +4 -1
- package/dist/handlers/createEnvironmentHandler.js +34 -1
- package/dist/handlers/createProjectHandler.js +62 -10
- package/dist/handlers/index.js +4 -14
- package/dist/handlers/searchEnvironmentsHandler.js +122 -0
- package/dist/handlers/searchExecutionsHandler.js +71 -0
- package/dist/handlers/searchProjectsHandler.js +72 -0
- package/dist/handlers/testPageChangesHandler.js +46 -5
- package/dist/handlers/triggerCrawlHandler.js +37 -7
- package/dist/handlers/updateEnvironmentHandler.js +94 -15
- package/dist/index.js +15 -2
- package/dist/services/index.js +3 -3
- package/dist/tools/createEnvironment.js +5 -1
- package/dist/tools/createProject.js +6 -4
- package/dist/tools/index.js +9 -42
- package/dist/tools/searchEnvironments.js +35 -0
- package/dist/tools/searchExecutions.js +31 -0
- package/dist/tools/searchProjects.js +30 -0
- package/dist/types/index.js +52 -71
- package/package.json +8 -2
- package/dist/handlers/cancelExecutionHandler.js +0 -41
- package/dist/handlers/createCredentialHandler.js +0 -60
- package/dist/handlers/deleteCredentialHandler.js +0 -51
- package/dist/handlers/getCredentialHandler.js +0 -49
- package/dist/handlers/getEnvironmentHandler.js +0 -49
- package/dist/handlers/getExecutionHandler.js +0 -37
- package/dist/handlers/getProjectHandler.js +0 -37
- package/dist/handlers/listCredentialsHandler.js +0 -93
- package/dist/handlers/listEnvironmentsHandler.js +0 -63
- package/dist/handlers/listExecutionsHandler.js +0 -35
- package/dist/handlers/listProjectsHandler.js +0 -32
- package/dist/handlers/listReposHandler.js +0 -27
- package/dist/handlers/listTeamsHandler.js +0 -27
- package/dist/handlers/updateCredentialHandler.js +0 -70
- package/dist/tools/cancelExecution.js +0 -22
- package/dist/tools/createCredential.js +0 -52
- package/dist/tools/deleteCredential.js +0 -24
- package/dist/tools/getCredential.js +0 -24
- package/dist/tools/getEnvironment.js +0 -23
- package/dist/tools/getExecution.js +0 -22
- package/dist/tools/getProject.js +0 -22
- package/dist/tools/listCredentials.js +0 -30
- package/dist/tools/listEnvironments.js +0 -28
- package/dist/tools/listExecutions.js +0 -24
- package/dist/tools/listProjects.js +0 -27
- package/dist/tools/listRepos.js +0 -23
- package/dist/tools/listTeams.js +0 -23
- package/dist/tools/updateCredential.js +0 -28
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SearchEnvironmentsInputSchema } from '../types/index.js';
|
|
2
|
+
import { searchEnvironmentsHandler } from '../handlers/searchEnvironmentsHandler.js';
|
|
3
|
+
const DESCRIPTION = `Search or look up environments, with credentials expanded inline per environment.
|
|
4
|
+
|
|
5
|
+
Two modes:
|
|
6
|
+
- uuid mode: {"uuid": "<env-uuid>"} → single env with full detail + its credentials. NotFound if the uuid doesn't exist.
|
|
7
|
+
- filter mode: omit uuid, optionally {"q": "<keyword>", "projectUuid", "page", "pageSize"} → paginated envs, each with its credentials.
|
|
8
|
+
|
|
9
|
+
Project resolution: if projectUuid is omitted, the current git repo's origin is auto-resolved to a DebuggAI project. Returns {error:"NoProjectResolved", environments:[]} if neither is available.
|
|
10
|
+
|
|
11
|
+
Credentials are returned inline per env as {uuid, label, username, role}. Password is NEVER returned — the handler defensively strips it regardless of what the service layer provides.
|
|
12
|
+
|
|
13
|
+
Response: {project, filter, pageInfo, environments[]} — each environment includes a credentials[] array.`;
|
|
14
|
+
export function buildSearchEnvironmentsTool() {
|
|
15
|
+
return {
|
|
16
|
+
name: 'search_environments',
|
|
17
|
+
title: 'Search Environments',
|
|
18
|
+
description: DESCRIPTION,
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
uuid: { type: 'string', description: 'Environment UUID. Returns single env with credentials inline. Mutually exclusive with projectUuid/q filter params.' },
|
|
23
|
+
projectUuid: { type: 'string', description: 'Override the auto-detected project. Used in filter mode.' },
|
|
24
|
+
q: { type: 'string', description: 'Free-text search over environment name. Mutually exclusive with uuid.' },
|
|
25
|
+
page: { type: 'number', description: 'Page number (1-indexed).' },
|
|
26
|
+
pageSize: { type: 'number', description: 'Page size (1..200). Default 20.' },
|
|
27
|
+
},
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function buildValidatedSearchEnvironmentsTool() {
|
|
33
|
+
const tool = buildSearchEnvironmentsTool();
|
|
34
|
+
return { ...tool, inputSchema: SearchEnvironmentsInputSchema, handler: searchEnvironmentsHandler };
|
|
35
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SearchExecutionsInputSchema } from '../types/index.js';
|
|
2
|
+
import { searchExecutionsHandler } from '../handlers/searchExecutionsHandler.js';
|
|
3
|
+
const DESCRIPTION = `Search or look up workflow executions (history of check_app_in_browser, trigger_crawl, and other workflow runs).
|
|
4
|
+
|
|
5
|
+
Two modes:
|
|
6
|
+
- uuid mode: {"uuid": "<execution-uuid>"} → single execution with FULL detail including nodeExecutions, state, errorInfo. NotFound if the uuid doesn't exist.
|
|
7
|
+
- filter mode: {"status": "completed"|"running"|"failed"|"cancelled", "projectUuid": "...", "page", "pageSize"} → paginated summaries.
|
|
8
|
+
|
|
9
|
+
Response shape: {filter, pageInfo, executions[]}. Summary items have outcome/status/durationMs/timestamps; uuid-mode items additionally have nodeExecutions + state + errorInfo.`;
|
|
10
|
+
export function buildSearchExecutionsTool() {
|
|
11
|
+
return {
|
|
12
|
+
name: 'search_executions',
|
|
13
|
+
title: 'Search Workflow Executions',
|
|
14
|
+
description: DESCRIPTION,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
uuid: { type: 'string', description: 'Execution UUID. Returns single execution with full detail. Mutually exclusive with projectUuid/status filters.' },
|
|
19
|
+
projectUuid: { type: 'string', description: 'Filter by project UUID.' },
|
|
20
|
+
status: { type: 'string', description: 'Filter by status: completed | running | failed | cancelled | pending.' },
|
|
21
|
+
page: { type: 'number', description: 'Page number (1-indexed).' },
|
|
22
|
+
pageSize: { type: 'number', description: 'Page size (1..200). Default 20.' },
|
|
23
|
+
},
|
|
24
|
+
additionalProperties: false,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function buildValidatedSearchExecutionsTool() {
|
|
29
|
+
const tool = buildSearchExecutionsTool();
|
|
30
|
+
return { ...tool, inputSchema: SearchExecutionsInputSchema, handler: searchExecutionsHandler };
|
|
31
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SearchProjectsInputSchema } from '../types/index.js';
|
|
2
|
+
import { searchProjectsHandler } from '../handlers/searchProjectsHandler.js';
|
|
3
|
+
const DESCRIPTION = `Search or look up projects.
|
|
4
|
+
|
|
5
|
+
Two modes:
|
|
6
|
+
- uuid mode: pass {"uuid": "<project-uuid>"} → returns that project with the curated detail view (uuid, name, slug, platform, repoName, description, status, language, framework, timestamp, lastMod), or isError:true NotFound.
|
|
7
|
+
- filter mode: omit uuid, optionally pass {"q": "<keyword>", "page": 1, "pageSize": 20} → returns a paginated list of summaries (uuid, name, slug, repoName).
|
|
8
|
+
|
|
9
|
+
Response shape is always {filter, pageInfo, projects[]}. uuid mode returns exactly one project; filter mode returns summaries.`;
|
|
10
|
+
export function buildSearchProjectsTool() {
|
|
11
|
+
return {
|
|
12
|
+
name: 'search_projects',
|
|
13
|
+
title: 'Search Projects',
|
|
14
|
+
description: DESCRIPTION,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
uuid: { type: 'string', description: 'Project UUID. When provided, returns exactly that project with full detail. Mutually exclusive with q.' },
|
|
19
|
+
q: { type: 'string', description: 'Free-text search (backend-side). Mutually exclusive with uuid.' },
|
|
20
|
+
page: { type: 'number', description: 'Page number (1-indexed). Default 1.' },
|
|
21
|
+
pageSize: { type: 'number', description: 'Page size (1..200). Default 20.' },
|
|
22
|
+
},
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function buildValidatedSearchProjectsTool() {
|
|
28
|
+
const tool = buildSearchProjectsTool();
|
|
29
|
+
return { ...tool, inputSchema: SearchProjectsInputSchema, handler: searchProjectsHandler };
|
|
30
|
+
}
|
package/dist/types/index.js
CHANGED
|
@@ -29,21 +29,50 @@ export const TriggerCrawlInputSchema = z.object({
|
|
|
29
29
|
timeoutSeconds: z.number().int().positive().max(1800, 'timeoutSeconds cannot exceed 1800 (30 min)').optional(),
|
|
30
30
|
repoName: z.string().optional(),
|
|
31
31
|
}).strict();
|
|
32
|
-
|
|
32
|
+
// ── New consolidated search schemas (bead ddq) ─────────────────────────────
|
|
33
|
+
// uuid and filter params are mutually exclusive: either look up one thing by
|
|
34
|
+
// uuid, or filter the collection. Mixing them is ambiguous.
|
|
35
|
+
export const SearchProjectsInputSchema = z.object({
|
|
36
|
+
uuid: z.string().uuid().optional(),
|
|
37
|
+
q: z.string().min(1).optional(),
|
|
38
|
+
page: z.number().int().min(1).optional(),
|
|
39
|
+
pageSize: z.number().int().min(1).optional(),
|
|
40
|
+
}).strict().refine((v) => !(v.uuid && (v.q !== undefined)), { message: 'Cannot combine uuid with filter params (q). Pass one or the other.' });
|
|
41
|
+
// projectUuid is a LOCATOR (required by the backend URL path for envs/creds), not a
|
|
42
|
+
// filter — so it's compatible with uuid mode. Only q and uuid are mutually exclusive.
|
|
43
|
+
export const SearchEnvironmentsInputSchema = z.object({
|
|
44
|
+
uuid: z.string().uuid().optional(),
|
|
33
45
|
projectUuid: z.string().uuid().optional(),
|
|
34
46
|
q: z.string().min(1).optional(),
|
|
35
47
|
page: z.number().int().min(1).optional(),
|
|
36
48
|
pageSize: z.number().int().min(1).optional(),
|
|
49
|
+
}).strict().refine((v) => !(v.uuid && v.q !== undefined), { message: 'Cannot combine uuid with q (they are mutually exclusive — uuid mode returns one env; q filters a list).' });
|
|
50
|
+
export const SearchExecutionsInputSchema = z.object({
|
|
51
|
+
uuid: z.string().uuid().optional(),
|
|
52
|
+
projectUuid: z.string().uuid().optional(),
|
|
53
|
+
status: z.string().min(1).optional(),
|
|
54
|
+
page: z.number().int().min(1).optional(),
|
|
55
|
+
pageSize: z.number().int().min(1).optional(),
|
|
56
|
+
}).strict().refine((v) => !(v.uuid && (v.projectUuid || v.status)), { message: 'Cannot combine uuid with filter params (projectUuid, status).' });
|
|
57
|
+
const CredentialSeedSchema = z.object({
|
|
58
|
+
label: z.string().min(1, 'label is required'),
|
|
59
|
+
username: z.string().min(1, 'username is required'),
|
|
60
|
+
password: z.string().min(1, 'password is required'),
|
|
61
|
+
role: z.string().min(1).optional(),
|
|
37
62
|
}).strict();
|
|
38
63
|
export const CreateEnvironmentInputSchema = z.object({
|
|
39
64
|
name: z.string().min(1, 'name is required'),
|
|
40
65
|
url: z.string().url('url is required for standard environments'),
|
|
41
66
|
description: z.string().optional(),
|
|
42
67
|
projectUuid: z.string().uuid().optional(),
|
|
68
|
+
credentials: z.array(CredentialSeedSchema).optional(),
|
|
43
69
|
}).strict();
|
|
44
|
-
|
|
70
|
+
const CredentialUpdateSchema = z.object({
|
|
45
71
|
uuid: z.string().uuid(),
|
|
46
|
-
|
|
72
|
+
label: z.string().min(1).optional(),
|
|
73
|
+
username: z.string().min(1).optional(),
|
|
74
|
+
password: z.string().min(1).optional(),
|
|
75
|
+
role: z.string().min(1).optional(),
|
|
47
76
|
}).strict();
|
|
48
77
|
export const UpdateEnvironmentInputSchema = z.object({
|
|
49
78
|
uuid: z.string().uuid(),
|
|
@@ -51,33 +80,14 @@ export const UpdateEnvironmentInputSchema = z.object({
|
|
|
51
80
|
url: z.string().url().optional(),
|
|
52
81
|
description: z.string().optional(),
|
|
53
82
|
projectUuid: z.string().uuid().optional(),
|
|
83
|
+
addCredentials: z.array(CredentialSeedSchema).optional(),
|
|
84
|
+
updateCredentials: z.array(CredentialUpdateSchema).optional(),
|
|
85
|
+
removeCredentialIds: z.array(z.string().uuid()).optional(),
|
|
54
86
|
}).strict();
|
|
55
87
|
export const DeleteEnvironmentInputSchema = z.object({
|
|
56
88
|
uuid: z.string().uuid(),
|
|
57
89
|
projectUuid: z.string().uuid().optional(),
|
|
58
90
|
}).strict();
|
|
59
|
-
export const GetCredentialInputSchema = z.object({
|
|
60
|
-
uuid: z.string().uuid(),
|
|
61
|
-
environmentId: z.string().uuid(),
|
|
62
|
-
projectUuid: z.string().uuid().optional(),
|
|
63
|
-
}).strict();
|
|
64
|
-
export const UpdateCredentialInputSchema = z.object({
|
|
65
|
-
uuid: z.string().uuid(),
|
|
66
|
-
environmentId: z.string().uuid(),
|
|
67
|
-
label: z.string().min(1).optional(),
|
|
68
|
-
username: z.string().min(1).optional(),
|
|
69
|
-
password: z.string().min(1).optional(),
|
|
70
|
-
role: z.string().min(1).optional(),
|
|
71
|
-
projectUuid: z.string().uuid().optional(),
|
|
72
|
-
}).strict();
|
|
73
|
-
export const DeleteCredentialInputSchema = z.object({
|
|
74
|
-
uuid: z.string().uuid(),
|
|
75
|
-
environmentId: z.string().uuid(),
|
|
76
|
-
projectUuid: z.string().uuid().optional(),
|
|
77
|
-
}).strict();
|
|
78
|
-
export const GetProjectInputSchema = z.object({
|
|
79
|
-
uuid: z.string().uuid(),
|
|
80
|
-
}).strict();
|
|
81
91
|
export const UpdateProjectInputSchema = z.object({
|
|
82
92
|
uuid: z.string().uuid(),
|
|
83
93
|
name: z.string().min(1).optional(),
|
|
@@ -86,55 +96,26 @@ export const UpdateProjectInputSchema = z.object({
|
|
|
86
96
|
export const DeleteProjectInputSchema = z.object({
|
|
87
97
|
uuid: z.string().uuid(),
|
|
88
98
|
}).strict();
|
|
89
|
-
export const ListExecutionsInputSchema = z.object({
|
|
90
|
-
status: z.string().min(1).optional(),
|
|
91
|
-
projectUuid: z.string().uuid().optional(),
|
|
92
|
-
page: z.number().int().min(1).optional(),
|
|
93
|
-
pageSize: z.number().int().min(1).optional(),
|
|
94
|
-
}).strict();
|
|
95
|
-
export const GetExecutionInputSchema = z.object({
|
|
96
|
-
uuid: z.string().uuid(),
|
|
97
|
-
}).strict();
|
|
98
|
-
export const CancelExecutionInputSchema = z.object({
|
|
99
|
-
uuid: z.string().uuid(),
|
|
100
|
-
}).strict();
|
|
101
|
-
export const ListCredentialsInputSchema = z.object({
|
|
102
|
-
environmentId: z.string().uuid().optional(),
|
|
103
|
-
projectUuid: z.string().uuid().optional(),
|
|
104
|
-
q: z.string().min(1).optional(),
|
|
105
|
-
role: z.string().min(1).optional(),
|
|
106
|
-
page: z.number().int().min(1).optional(),
|
|
107
|
-
pageSize: z.number().int().min(1).optional(),
|
|
108
|
-
}).strict();
|
|
109
|
-
export const CreateCredentialInputSchema = z.object({
|
|
110
|
-
environmentId: z.string().uuid(),
|
|
111
|
-
label: z.string().min(1, 'label is required'),
|
|
112
|
-
username: z.string().min(1, 'username is required'),
|
|
113
|
-
password: z.string().min(1, 'password is required'),
|
|
114
|
-
role: z.string().min(1).optional(),
|
|
115
|
-
projectUuid: z.string().uuid().optional(),
|
|
116
|
-
}).strict();
|
|
117
|
-
export const ListProjectsInputSchema = z.object({
|
|
118
|
-
q: z.string().min(1).optional(),
|
|
119
|
-
page: z.number().int().min(1).optional(),
|
|
120
|
-
pageSize: z.number().int().min(1).optional(),
|
|
121
|
-
}).strict();
|
|
122
|
-
export const ListTeamsInputSchema = z.object({
|
|
123
|
-
q: z.string().min(1).optional(),
|
|
124
|
-
page: z.number().int().min(1).optional(),
|
|
125
|
-
pageSize: z.number().int().min(1).optional(),
|
|
126
|
-
}).strict();
|
|
127
|
-
export const ListReposInputSchema = z.object({
|
|
128
|
-
q: z.string().min(1).optional(),
|
|
129
|
-
page: z.number().int().min(1).optional(),
|
|
130
|
-
pageSize: z.number().int().min(1).optional(),
|
|
131
|
-
}).strict();
|
|
132
99
|
export const CreateProjectInputSchema = z.object({
|
|
133
100
|
name: z.string().min(1),
|
|
134
101
|
platform: z.string().min(1),
|
|
135
|
-
teamUuid: z.string().uuid(),
|
|
136
|
-
|
|
137
|
-
|
|
102
|
+
teamUuid: z.string().uuid().optional(),
|
|
103
|
+
teamName: z.string().min(1).optional(),
|
|
104
|
+
repoUuid: z.string().uuid().optional(),
|
|
105
|
+
repoName: z.string().min(1).optional(),
|
|
106
|
+
}).strict()
|
|
107
|
+
.refine((v) => !(v.teamUuid && v.teamName), {
|
|
108
|
+
message: 'Provide teamUuid OR teamName, not both.',
|
|
109
|
+
})
|
|
110
|
+
.refine((v) => !(v.repoUuid && v.repoName), {
|
|
111
|
+
message: 'Provide repoUuid OR repoName, not both.',
|
|
112
|
+
})
|
|
113
|
+
.refine((v) => v.teamUuid || v.teamName, {
|
|
114
|
+
message: 'Must provide teamUuid or teamName.',
|
|
115
|
+
})
|
|
116
|
+
.refine((v) => v.repoUuid || v.repoName, {
|
|
117
|
+
message: 'Must provide repoUuid or repoName.',
|
|
118
|
+
});
|
|
138
119
|
/**
|
|
139
120
|
* Error types
|
|
140
121
|
*/
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@debugg-ai/debugg-ai-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.65",
|
|
4
4
|
"description": "Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"debugg-ai-mcp": "dist/index.js"
|
|
8
8
|
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20.20.0"
|
|
11
|
+
},
|
|
9
12
|
"files": [
|
|
10
|
-
"dist"
|
|
13
|
+
"dist",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
11
17
|
],
|
|
12
18
|
"scripts": {
|
|
13
19
|
"lint": "eslint .",
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
const logger = new Logger({ module: 'cancelExecutionHandler' });
|
|
6
|
-
function errorResponse(error, message, uuid) {
|
|
7
|
-
return {
|
|
8
|
-
content: [{ type: 'text', text: JSON.stringify({ error, message, uuid }, null, 2) }],
|
|
9
|
-
isError: true,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export async function cancelExecutionHandler(input, _context) {
|
|
13
|
-
const start = Date.now();
|
|
14
|
-
logger.toolStart('cancel_execution', { uuid: input.uuid });
|
|
15
|
-
try {
|
|
16
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
17
|
-
await client.init();
|
|
18
|
-
try {
|
|
19
|
-
await client.workflows.cancelExecution(input.uuid);
|
|
20
|
-
logger.toolComplete('cancel_execution', Date.now() - start);
|
|
21
|
-
return {
|
|
22
|
-
content: [{ type: 'text', text: JSON.stringify({ cancelled: true, uuid: input.uuid }, null, 2) }],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
const status = err?.statusCode ?? err?.response?.status;
|
|
27
|
-
const detail = err?.responseData?.error ?? err?.message ?? '';
|
|
28
|
-
if (status === 404) {
|
|
29
|
-
return errorResponse('NotFound', `Execution ${input.uuid} not found.`, input.uuid);
|
|
30
|
-
}
|
|
31
|
-
if (status === 409 || /already|completed|cannot.?cancel/i.test(detail)) {
|
|
32
|
-
return errorResponse('AlreadyCompleted', detail || `Execution ${input.uuid} cannot be cancelled.`, input.uuid);
|
|
33
|
-
}
|
|
34
|
-
throw err;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
logger.toolError('cancel_execution', error, Date.now() - start);
|
|
39
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'cancel_execution');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
import { detectRepoName } from '../utils/gitContext.js';
|
|
6
|
-
const logger = new Logger({ module: 'createCredentialHandler' });
|
|
7
|
-
export async function createCredentialHandler(input, _context) {
|
|
8
|
-
const start = Date.now();
|
|
9
|
-
logger.toolStart('create_credential', {
|
|
10
|
-
environmentId: input.environmentId,
|
|
11
|
-
label: input.label,
|
|
12
|
-
hasRole: !!input.role,
|
|
13
|
-
projectUuid: input.projectUuid,
|
|
14
|
-
});
|
|
15
|
-
try {
|
|
16
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
17
|
-
await client.init();
|
|
18
|
-
let projectUuid = input.projectUuid;
|
|
19
|
-
if (!projectUuid) {
|
|
20
|
-
const repoName = detectRepoName();
|
|
21
|
-
if (!repoName) {
|
|
22
|
-
return {
|
|
23
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
24
|
-
error: 'NoProjectResolved',
|
|
25
|
-
message: 'No git repo detected and no projectUuid provided. Pass projectUuid (get it from list_projects) or invoke from a directory with a git origin.',
|
|
26
|
-
}, null, 2) }],
|
|
27
|
-
isError: true,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const project = await client.findProjectByRepoName(repoName);
|
|
31
|
-
if (!project) {
|
|
32
|
-
return {
|
|
33
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
34
|
-
error: 'NoProjectResolved',
|
|
35
|
-
message: `No DebuggAI project found for repo "${repoName}". Pass projectUuid explicitly.`,
|
|
36
|
-
}, null, 2) }],
|
|
37
|
-
isError: true,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
projectUuid = project.uuid;
|
|
41
|
-
}
|
|
42
|
-
const cred = await client.createCredential(projectUuid, input.environmentId, {
|
|
43
|
-
label: input.label,
|
|
44
|
-
username: input.username,
|
|
45
|
-
password: input.password,
|
|
46
|
-
role: input.role,
|
|
47
|
-
});
|
|
48
|
-
const payload = {
|
|
49
|
-
created: true,
|
|
50
|
-
projectUuid,
|
|
51
|
-
credential: cred,
|
|
52
|
-
};
|
|
53
|
-
logger.toolComplete('create_credential', Date.now() - start);
|
|
54
|
-
return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }] };
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
logger.toolError('create_credential', error, Date.now() - start);
|
|
58
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'create_credential');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
import { detectRepoName } from '../utils/gitContext.js';
|
|
6
|
-
const logger = new Logger({ module: 'deleteCredentialHandler' });
|
|
7
|
-
function notFound(uuid, context) {
|
|
8
|
-
return {
|
|
9
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
10
|
-
error: 'NotFound',
|
|
11
|
-
message: `Credential ${uuid} not found (${context}).`,
|
|
12
|
-
uuid,
|
|
13
|
-
}, null, 2) }],
|
|
14
|
-
isError: true,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export async function deleteCredentialHandler(input, _context) {
|
|
18
|
-
const start = Date.now();
|
|
19
|
-
logger.toolStart('delete_credential', { uuid: input.uuid, environmentId: input.environmentId });
|
|
20
|
-
try {
|
|
21
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
22
|
-
await client.init();
|
|
23
|
-
let projectUuid = input.projectUuid;
|
|
24
|
-
if (!projectUuid) {
|
|
25
|
-
const repoName = detectRepoName();
|
|
26
|
-
if (!repoName)
|
|
27
|
-
return notFound(input.uuid, 'no git repo and no projectUuid');
|
|
28
|
-
const project = await client.findProjectByRepoName(repoName);
|
|
29
|
-
if (!project)
|
|
30
|
-
return notFound(input.uuid, `no project for repo "${repoName}"`);
|
|
31
|
-
projectUuid = project.uuid;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
await client.deleteCredential(projectUuid, input.environmentId, input.uuid);
|
|
35
|
-
logger.toolComplete('delete_credential', Date.now() - start);
|
|
36
|
-
return {
|
|
37
|
-
content: [{ type: 'text', text: JSON.stringify({ deleted: true, uuid: input.uuid }, null, 2) }],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
if (err?.statusCode === 404 || err?.response?.status === 404) {
|
|
42
|
-
return notFound(input.uuid, `backend 404 for env ${input.environmentId}`);
|
|
43
|
-
}
|
|
44
|
-
throw err;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
logger.toolError('delete_credential', error, Date.now() - start);
|
|
49
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'delete_credential');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
import { detectRepoName } from '../utils/gitContext.js';
|
|
6
|
-
const logger = new Logger({ module: 'getCredentialHandler' });
|
|
7
|
-
function notFound(uuid, context) {
|
|
8
|
-
return {
|
|
9
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
10
|
-
error: 'NotFound',
|
|
11
|
-
message: `Credential ${uuid} not found (${context}).`,
|
|
12
|
-
uuid,
|
|
13
|
-
}, null, 2) }],
|
|
14
|
-
isError: true,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export async function getCredentialHandler(input, _context) {
|
|
18
|
-
const start = Date.now();
|
|
19
|
-
logger.toolStart('get_credential', { uuid: input.uuid, environmentId: input.environmentId, projectUuid: input.projectUuid });
|
|
20
|
-
try {
|
|
21
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
22
|
-
await client.init();
|
|
23
|
-
let projectUuid = input.projectUuid;
|
|
24
|
-
if (!projectUuid) {
|
|
25
|
-
const repoName = detectRepoName();
|
|
26
|
-
if (!repoName)
|
|
27
|
-
return notFound(input.uuid, 'no git repo and no projectUuid');
|
|
28
|
-
const project = await client.findProjectByRepoName(repoName);
|
|
29
|
-
if (!project)
|
|
30
|
-
return notFound(input.uuid, `no project for repo "${repoName}"`);
|
|
31
|
-
projectUuid = project.uuid;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const credential = await client.getCredential(projectUuid, input.environmentId, input.uuid);
|
|
35
|
-
logger.toolComplete('get_credential', Date.now() - start);
|
|
36
|
-
return { content: [{ type: 'text', text: JSON.stringify({ credential }, null, 2) }] };
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
if (err?.statusCode === 404 || err?.response?.status === 404) {
|
|
40
|
-
return notFound(input.uuid, `backend 404 for env ${input.environmentId}`);
|
|
41
|
-
}
|
|
42
|
-
throw err;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
logger.toolError('get_credential', error, Date.now() - start);
|
|
47
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'get_credential');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
import { detectRepoName } from '../utils/gitContext.js';
|
|
6
|
-
const logger = new Logger({ module: 'getEnvironmentHandler' });
|
|
7
|
-
function notFound(uuid, context) {
|
|
8
|
-
return {
|
|
9
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
10
|
-
error: 'NotFound',
|
|
11
|
-
message: `Environment ${uuid} not found (${context}).`,
|
|
12
|
-
uuid,
|
|
13
|
-
}, null, 2) }],
|
|
14
|
-
isError: true,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export async function getEnvironmentHandler(input, _context) {
|
|
18
|
-
const start = Date.now();
|
|
19
|
-
logger.toolStart('get_environment', { uuid: input.uuid, projectUuid: input.projectUuid });
|
|
20
|
-
try {
|
|
21
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
22
|
-
await client.init();
|
|
23
|
-
let projectUuid = input.projectUuid;
|
|
24
|
-
if (!projectUuid) {
|
|
25
|
-
const repoName = detectRepoName();
|
|
26
|
-
if (!repoName)
|
|
27
|
-
return notFound(input.uuid, 'no git repo detected and no projectUuid provided');
|
|
28
|
-
const project = await client.findProjectByRepoName(repoName);
|
|
29
|
-
if (!project)
|
|
30
|
-
return notFound(input.uuid, `no project found for repo "${repoName}"`);
|
|
31
|
-
projectUuid = project.uuid;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const environment = await client.getEnvironment(projectUuid, input.uuid);
|
|
35
|
-
logger.toolComplete('get_environment', Date.now() - start);
|
|
36
|
-
return { content: [{ type: 'text', text: JSON.stringify({ environment }, null, 2) }] };
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
if (err?.statusCode === 404 || err?.response?.status === 404) {
|
|
40
|
-
return notFound(input.uuid, `backend returned 404 for project ${projectUuid}`);
|
|
41
|
-
}
|
|
42
|
-
throw err;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
logger.toolError('get_environment', error, Date.now() - start);
|
|
47
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'get_environment');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
const logger = new Logger({ module: 'getExecutionHandler' });
|
|
6
|
-
function notFound(uuid) {
|
|
7
|
-
return {
|
|
8
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
9
|
-
error: 'NotFound',
|
|
10
|
-
message: `Execution ${uuid} not found.`,
|
|
11
|
-
uuid,
|
|
12
|
-
}, null, 2) }],
|
|
13
|
-
isError: true,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export async function getExecutionHandler(input, _context) {
|
|
17
|
-
const start = Date.now();
|
|
18
|
-
logger.toolStart('get_execution', { uuid: input.uuid });
|
|
19
|
-
try {
|
|
20
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
21
|
-
await client.init();
|
|
22
|
-
try {
|
|
23
|
-
const execution = await client.workflows.getExecution(input.uuid);
|
|
24
|
-
logger.toolComplete('get_execution', Date.now() - start);
|
|
25
|
-
return { content: [{ type: 'text', text: JSON.stringify({ execution }, null, 2) }] };
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
if (err?.statusCode === 404 || err?.response?.status === 404)
|
|
29
|
-
return notFound(input.uuid);
|
|
30
|
-
throw err;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
logger.toolError('get_execution', error, Date.now() - start);
|
|
35
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'get_execution');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../utils/logger.js';
|
|
2
|
-
import { handleExternalServiceError } from '../utils/errors.js';
|
|
3
|
-
import { DebuggAIServerClient } from '../services/index.js';
|
|
4
|
-
import { config } from '../config/index.js';
|
|
5
|
-
const logger = new Logger({ module: 'getProjectHandler' });
|
|
6
|
-
function notFound(uuid) {
|
|
7
|
-
return {
|
|
8
|
-
content: [{ type: 'text', text: JSON.stringify({
|
|
9
|
-
error: 'NotFound',
|
|
10
|
-
message: `Project ${uuid} not found.`,
|
|
11
|
-
uuid,
|
|
12
|
-
}, null, 2) }],
|
|
13
|
-
isError: true,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export async function getProjectHandler(input, _context) {
|
|
17
|
-
const start = Date.now();
|
|
18
|
-
logger.toolStart('get_project', { uuid: input.uuid });
|
|
19
|
-
try {
|
|
20
|
-
const client = new DebuggAIServerClient(config.api.key);
|
|
21
|
-
await client.init();
|
|
22
|
-
try {
|
|
23
|
-
const project = await client.getProject(input.uuid);
|
|
24
|
-
logger.toolComplete('get_project', Date.now() - start);
|
|
25
|
-
return { content: [{ type: 'text', text: JSON.stringify({ project }, null, 2) }] };
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
if (err?.statusCode === 404 || err?.response?.status === 404)
|
|
29
|
-
return notFound(input.uuid);
|
|
30
|
-
throw err;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
logger.toolError('get_project', error, Date.now() - start);
|
|
35
|
-
throw handleExternalServiceError(error, 'DebuggAI', 'get_project');
|
|
36
|
-
}
|
|
37
|
-
}
|