@debugg-ai/debugg-ai-mcp 1.0.55 → 1.0.57
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/README.md +69 -6
- package/dist/handlers/cancelExecutionHandler.js +41 -0
- package/dist/handlers/createCredentialHandler.js +60 -0
- package/dist/handlers/createEnvironmentHandler.js +54 -0
- package/dist/handlers/deleteCredentialHandler.js +51 -0
- package/dist/handlers/deleteEnvironmentHandler.js +51 -0
- package/dist/handlers/deleteProjectHandler.js +39 -0
- package/dist/handlers/getCredentialHandler.js +49 -0
- package/dist/handlers/getEnvironmentHandler.js +49 -0
- package/dist/handlers/getExecutionHandler.js +37 -0
- package/dist/handlers/getProjectHandler.js +37 -0
- package/dist/handlers/index.js +17 -0
- package/dist/handlers/listCredentialsHandler.js +71 -0
- package/dist/handlers/listEnvironmentsHandler.js +59 -0
- package/dist/handlers/listExecutionsHandler.js +31 -0
- package/dist/handlers/listProjectsHandler.js +30 -0
- package/dist/handlers/testPageChangesHandler.js +4 -1
- package/dist/handlers/updateCredentialHandler.js +70 -0
- package/dist/handlers/updateEnvironmentHandler.js +59 -0
- package/dist/handlers/updateProjectHandler.js +45 -0
- package/dist/index.js +2 -19
- package/dist/services/index.js +243 -0
- package/dist/services/projectContext.js +42 -30
- package/dist/services/workflows.js +26 -0
- package/dist/tools/cancelExecution.js +22 -0
- package/dist/tools/createCredential.js +52 -0
- package/dist/tools/createEnvironment.js +42 -0
- package/dist/tools/deleteCredential.js +24 -0
- package/dist/tools/deleteEnvironment.js +23 -0
- package/dist/tools/deleteProject.js +22 -0
- package/dist/tools/getCredential.js +24 -0
- package/dist/tools/getEnvironment.js +23 -0
- package/dist/tools/getExecution.js +22 -0
- package/dist/tools/getProject.js +22 -0
- package/dist/tools/index.js +61 -5
- package/dist/tools/listCredentials.js +40 -0
- package/dist/tools/listEnvironments.js +32 -0
- package/dist/tools/listExecutions.js +22 -0
- package/dist/tools/listProjects.js +28 -0
- package/dist/tools/updateCredential.js +28 -0
- package/dist/tools/updateEnvironment.js +26 -0
- package/dist/tools/updateProject.js +24 -0
- package/dist/types/index.js +82 -0
- package/package.json +3 -3
|
@@ -9,41 +9,53 @@ import { detectRepoName } from '../utils/gitContext.js';
|
|
|
9
9
|
import { Logger } from '../utils/logger.js';
|
|
10
10
|
const logger = new Logger({ module: 'projectContext' });
|
|
11
11
|
let cached = null;
|
|
12
|
-
let
|
|
12
|
+
let inFlight = null;
|
|
13
13
|
/**
|
|
14
14
|
* Resolve the current project context: repo → project → environments → credentials.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* Caches the first successful result. Concurrent calls share a single in-flight
|
|
17
|
+
* promise. Failures are NOT cached — the next call will retry — so a transient
|
|
18
|
+
* network error on the first tool call doesn't permanently disable the service.
|
|
16
19
|
*/
|
|
17
|
-
const STARTUP_TIMEOUT_MS = 10_000;
|
|
20
|
+
const STARTUP_TIMEOUT_MS = 10_000;
|
|
18
21
|
export async function resolveProjectContext() {
|
|
19
|
-
if (
|
|
22
|
+
if (cached)
|
|
20
23
|
return cached;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
24
|
+
if (inFlight)
|
|
25
|
+
return inFlight;
|
|
26
|
+
inFlight = (async () => {
|
|
27
|
+
const repoName = detectRepoName();
|
|
28
|
+
if (!repoName) {
|
|
29
|
+
logger.info('No git repo detected — skipping project context');
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
let timer = null;
|
|
33
|
+
try {
|
|
34
|
+
const result = await Promise.race([
|
|
35
|
+
resolveProjectContextInner(repoName),
|
|
36
|
+
new Promise((resolve) => {
|
|
37
|
+
timer = setTimeout(() => {
|
|
38
|
+
logger.warn('Project context resolution timed out');
|
|
39
|
+
resolve(null);
|
|
40
|
+
}, STARTUP_TIMEOUT_MS);
|
|
41
|
+
}),
|
|
42
|
+
]);
|
|
43
|
+
if (result)
|
|
44
|
+
cached = result;
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
logger.warn(`Failed to resolve project context: ${err}`);
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
if (timer)
|
|
53
|
+
clearTimeout(timer);
|
|
54
|
+
}
|
|
55
|
+
})().finally(() => {
|
|
56
|
+
inFlight = null;
|
|
57
|
+
});
|
|
58
|
+
return inFlight;
|
|
47
59
|
}
|
|
48
60
|
async function resolveProjectContextInner(repoName) {
|
|
49
61
|
try {
|
|
@@ -47,6 +47,32 @@ export const createWorkflowsService = (tx) => {
|
|
|
47
47
|
}
|
|
48
48
|
return response;
|
|
49
49
|
},
|
|
50
|
+
async listExecutions(filters) {
|
|
51
|
+
const params = {};
|
|
52
|
+
if (filters.status)
|
|
53
|
+
params.status = filters.status;
|
|
54
|
+
if (filters.limit)
|
|
55
|
+
params.pageSize = filters.limit; // backend uses page_size (snake_case via transport)
|
|
56
|
+
const response = await tx.get('api/v1/workflows/executions/', params);
|
|
57
|
+
return {
|
|
58
|
+
count: response?.count ?? 0,
|
|
59
|
+
executions: (response?.results ?? []).map((e) => ({
|
|
60
|
+
uuid: e.uuid,
|
|
61
|
+
workflow: e.workflow,
|
|
62
|
+
status: e.status,
|
|
63
|
+
mode: e.mode,
|
|
64
|
+
source: e.source,
|
|
65
|
+
outcome: e.outcome ?? null,
|
|
66
|
+
startedAt: e.startedAt,
|
|
67
|
+
completedAt: e.completedAt,
|
|
68
|
+
durationMs: e.durationMs,
|
|
69
|
+
timestamp: e.timestamp,
|
|
70
|
+
})),
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
async cancelExecution(executionUuid) {
|
|
74
|
+
await tx.post(`api/v1/workflows/executions/${executionUuid}/cancel/`, {});
|
|
75
|
+
},
|
|
50
76
|
async pollExecution(executionUuid, onUpdate, signal) {
|
|
51
77
|
const deadline = Date.now() + EXECUTION_TIMEOUT_MS;
|
|
52
78
|
const pollStart = Date.now();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CancelExecutionInputSchema } from '../types/index.js';
|
|
2
|
+
import { cancelExecutionHandler } from '../handlers/cancelExecutionHandler.js';
|
|
3
|
+
const DESCRIPTION = `Cancel an in-flight workflow execution by UUID. Returns {cancelled:true, uuid} on success. Returns isError:true + AlreadyCompleted when the execution is already done (backend 409). Returns isError:true + NotFound when uuid doesn't exist.`;
|
|
4
|
+
export function buildCancelExecutionTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'cancel_execution',
|
|
7
|
+
title: 'Cancel Workflow Execution',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'Execution UUID. Required.' },
|
|
13
|
+
},
|
|
14
|
+
required: ['uuid'],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function buildValidatedCancelExecutionTool() {
|
|
20
|
+
const tool = buildCancelExecutionTool();
|
|
21
|
+
return { ...tool, inputSchema: CancelExecutionInputSchema, handler: cancelExecutionHandler };
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { CreateCredentialInputSchema } from '../types/index.js';
|
|
2
|
+
import { createCredentialHandler } from '../handlers/createCredentialHandler.js';
|
|
3
|
+
const DESCRIPTION = `Create a new credential under an environment. Required: environmentId, label, username, password. Optional role (e.g. "admin", "guest"). password is write-only — the response returns only uuid/label/username/role/environmentUuid, never the raw password. Defaults to the project resolved from the current git repo; pass projectUuid to target a different project (get UUIDs via list_projects). Returns the created credential's uuid for use with check_app_in_browser via credentialId.`;
|
|
4
|
+
export function buildCreateCredentialTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'create_credential',
|
|
7
|
+
title: 'Create Environment Credential',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
environmentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'UUID of the environment this credential belongs to. Required.',
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Human-readable label for the credential (e.g. "Admin Account"). Required.',
|
|
19
|
+
minLength: 1,
|
|
20
|
+
},
|
|
21
|
+
username: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Username or email used to log in. Required.',
|
|
24
|
+
minLength: 1,
|
|
25
|
+
},
|
|
26
|
+
password: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Password. Write-only — never echoed in any MCP tool response. Required.',
|
|
29
|
+
minLength: 1,
|
|
30
|
+
},
|
|
31
|
+
role: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'Optional: role string (e.g. "admin", "guest"). Persists on the credential and can be used with credentialRole resolution.',
|
|
34
|
+
},
|
|
35
|
+
projectUuid: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Optional: UUID of the target project. Defaults to the project resolved from the current git repo.',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
required: ['environmentId', 'label', 'username', 'password'],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function buildValidatedCreateCredentialTool() {
|
|
46
|
+
const tool = buildCreateCredentialTool();
|
|
47
|
+
return {
|
|
48
|
+
...tool,
|
|
49
|
+
inputSchema: CreateCredentialInputSchema,
|
|
50
|
+
handler: createCredentialHandler,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CreateEnvironmentInputSchema } from '../types/index.js';
|
|
2
|
+
import { createEnvironmentHandler } from '../handlers/createEnvironmentHandler.js';
|
|
3
|
+
const DESCRIPTION = `Create a new environment under a DebuggAI project. Both name and url are required (backend rejects standard environments without a URL). Optional description. Defaults to the project resolved from the current git repo; pass projectUuid to target a different project (get UUIDs via list_projects). Returns the created environment's uuid so you can reference it when running check_app_in_browser or creating credentials.`;
|
|
4
|
+
export function buildCreateEnvironmentTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'create_environment',
|
|
7
|
+
title: 'Create Project Environment',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
name: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Short label for the environment (e.g. "staging", "production"). Required.',
|
|
15
|
+
minLength: 1,
|
|
16
|
+
},
|
|
17
|
+
url: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Base URL for the environment (e.g. https://staging.example.com). Required.',
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Optional: free-text description.',
|
|
24
|
+
},
|
|
25
|
+
projectUuid: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'Optional: UUID of the target project. Defaults to the project resolved from the current git repo.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ['name', 'url'],
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function buildValidatedCreateEnvironmentTool() {
|
|
36
|
+
const tool = buildCreateEnvironmentTool();
|
|
37
|
+
return {
|
|
38
|
+
...tool,
|
|
39
|
+
inputSchema: CreateEnvironmentInputSchema,
|
|
40
|
+
handler: createEnvironmentHandler,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DeleteCredentialInputSchema } from '../types/index.js';
|
|
2
|
+
import { deleteCredentialHandler } from '../handlers/deleteCredentialHandler.js';
|
|
3
|
+
const DESCRIPTION = `Delete a credential by UUID. Returns {deleted:true, uuid}. Requires environmentId. Destructive — the credential is gone. Returns isError:true + NotFound when already deleted or uuid doesn't exist.`;
|
|
4
|
+
export function buildDeleteCredentialTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'delete_credential',
|
|
7
|
+
title: 'Delete Credential',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the credential. Required.' },
|
|
13
|
+
environmentId: { type: 'string', description: 'UUID of the environment the cred belongs to. Required.' },
|
|
14
|
+
projectUuid: { type: 'string', description: 'Optional: project UUID. Defaults to git-auto-detect.' },
|
|
15
|
+
},
|
|
16
|
+
required: ['uuid', 'environmentId'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function buildValidatedDeleteCredentialTool() {
|
|
22
|
+
const tool = buildDeleteCredentialTool();
|
|
23
|
+
return { ...tool, inputSchema: DeleteCredentialInputSchema, handler: deleteCredentialHandler };
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DeleteEnvironmentInputSchema } from '../types/index.js';
|
|
2
|
+
import { deleteEnvironmentHandler } from '../handlers/deleteEnvironmentHandler.js';
|
|
3
|
+
const DESCRIPTION = `Delete an environment by UUID. Returns {deleted: true, uuid}. Destructive — cascades per backend behavior (credentials under the env are typically removed). Defaults to the project resolved from the current git repo; pass projectUuid to target a different project. Returns isError:true with NotFound when the uuid doesn't exist or was already deleted.`;
|
|
4
|
+
export function buildDeleteEnvironmentTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'delete_environment',
|
|
7
|
+
title: 'Delete Environment',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the environment to delete. Required.' },
|
|
13
|
+
projectUuid: { type: 'string', description: 'Optional: UUID of the target project. Defaults to git-auto-detect.' },
|
|
14
|
+
},
|
|
15
|
+
required: ['uuid'],
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function buildValidatedDeleteEnvironmentTool() {
|
|
21
|
+
const tool = buildDeleteEnvironmentTool();
|
|
22
|
+
return { ...tool, inputSchema: DeleteEnvironmentInputSchema, handler: deleteEnvironmentHandler };
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeleteProjectInputSchema } from '../types/index.js';
|
|
2
|
+
import { deleteProjectHandler } from '../handlers/deleteProjectHandler.js';
|
|
3
|
+
const DESCRIPTION = `Delete a project by UUID. Returns {deleted:true, uuid}. **DESTRUCTIVE** — removes the project and its associated environments, credentials, and test history. No undo. Returns isError:true + NotFound when already deleted or uuid doesn't exist.`;
|
|
4
|
+
export function buildDeleteProjectTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'delete_project',
|
|
7
|
+
title: 'Delete Project',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the project to delete. Required.' },
|
|
13
|
+
},
|
|
14
|
+
required: ['uuid'],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function buildValidatedDeleteProjectTool() {
|
|
20
|
+
const tool = buildDeleteProjectTool();
|
|
21
|
+
return { ...tool, inputSchema: DeleteProjectInputSchema, handler: deleteProjectHandler };
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GetCredentialInputSchema } from '../types/index.js';
|
|
2
|
+
import { getCredentialHandler } from '../handlers/getCredentialHandler.js';
|
|
3
|
+
const DESCRIPTION = `Fetch a single credential by UUID. Returns {credential:{uuid,label,username,role,environmentUuid,environmentName,isActive,isDefault,description,timestamp,lastMod}}. Never returns the password. Requires environmentId. Returns isError:true + NotFound when the uuid doesn't exist.`;
|
|
4
|
+
export function buildGetCredentialTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'get_credential',
|
|
7
|
+
title: 'Get Credential by UUID',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the credential. Required.' },
|
|
13
|
+
environmentId: { type: 'string', description: 'UUID of the environment the cred belongs to. Required.' },
|
|
14
|
+
projectUuid: { type: 'string', description: 'Optional: project UUID. Defaults to git-auto-detect.' },
|
|
15
|
+
},
|
|
16
|
+
required: ['uuid', 'environmentId'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function buildValidatedGetCredentialTool() {
|
|
22
|
+
const tool = buildGetCredentialTool();
|
|
23
|
+
return { ...tool, inputSchema: GetCredentialInputSchema, handler: getCredentialHandler };
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GetEnvironmentInputSchema } from '../types/index.js';
|
|
2
|
+
import { getEnvironmentHandler } from '../handlers/getEnvironmentHandler.js';
|
|
3
|
+
const DESCRIPTION = `Fetch a single environment by UUID. Returns full detail (uuid, name, url, isActive, description, endpointType, activeUrl, timestamp, lastMod). Defaults to the project resolved from the current git repo; pass projectUuid to target a different project. Returns isError:true with NotFound when the uuid doesn't exist.`;
|
|
4
|
+
export function buildGetEnvironmentTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'get_environment',
|
|
7
|
+
title: 'Get Environment by UUID',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the environment to fetch. Required.' },
|
|
13
|
+
projectUuid: { type: 'string', description: 'Optional: UUID of the target project. Defaults to git-auto-detect.' },
|
|
14
|
+
},
|
|
15
|
+
required: ['uuid'],
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function buildValidatedGetEnvironmentTool() {
|
|
21
|
+
const tool = buildGetEnvironmentTool();
|
|
22
|
+
return { ...tool, inputSchema: GetEnvironmentInputSchema, handler: getEnvironmentHandler };
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GetExecutionInputSchema } from '../types/index.js';
|
|
2
|
+
import { getExecutionHandler } from '../handlers/getExecutionHandler.js';
|
|
3
|
+
const DESCRIPTION = `Fetch full detail for a single workflow execution. Returns {execution:{uuid,status,state,outcome,startedAt,completedAt,durationMs,nodeExecutions,executionSummary,errorInfo,contextData,...}}. Returns isError:true + NotFound when uuid doesn't exist.`;
|
|
4
|
+
export function buildGetExecutionTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'get_execution',
|
|
7
|
+
title: 'Get Execution Detail',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'Execution UUID. Required.' },
|
|
13
|
+
},
|
|
14
|
+
required: ['uuid'],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function buildValidatedGetExecutionTool() {
|
|
20
|
+
const tool = buildGetExecutionTool();
|
|
21
|
+
return { ...tool, inputSchema: GetExecutionInputSchema, handler: getExecutionHandler };
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GetProjectInputSchema } from '../types/index.js';
|
|
2
|
+
import { getProjectHandler } from '../handlers/getProjectHandler.js';
|
|
3
|
+
const DESCRIPTION = `Fetch a single project by UUID. Returns {project:{uuid,name,slug,platform,repoName,description,status,language,framework,timestamp,lastMod}}. Response is simplified — heavy internal fields (team, runner_configuration, github internals) are omitted. Returns isError:true + NotFound when uuid doesn't exist.`;
|
|
4
|
+
export function buildGetProjectTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'get_project',
|
|
7
|
+
title: 'Get Project by UUID',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the project. Required.' },
|
|
13
|
+
},
|
|
14
|
+
required: ['uuid'],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function buildValidatedGetProjectTool() {
|
|
20
|
+
const tool = buildGetProjectTool();
|
|
21
|
+
return { ...tool, inputSchema: GetProjectInputSchema, handler: getProjectHandler };
|
|
22
|
+
}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { buildTestPageChangesTool, buildValidatedTestPageChangesTool } from './testPageChanges.js';
|
|
2
|
+
import { buildListEnvironmentsTool, buildValidatedListEnvironmentsTool } from './listEnvironments.js';
|
|
3
|
+
import { buildListCredentialsTool, buildValidatedListCredentialsTool } from './listCredentials.js';
|
|
4
|
+
import { buildListProjectsTool, buildValidatedListProjectsTool } from './listProjects.js';
|
|
5
|
+
import { buildCreateEnvironmentTool, buildValidatedCreateEnvironmentTool } from './createEnvironment.js';
|
|
6
|
+
import { buildCreateCredentialTool, buildValidatedCreateCredentialTool } from './createCredential.js';
|
|
7
|
+
import { buildGetEnvironmentTool, buildValidatedGetEnvironmentTool } from './getEnvironment.js';
|
|
8
|
+
import { buildUpdateEnvironmentTool, buildValidatedUpdateEnvironmentTool } from './updateEnvironment.js';
|
|
9
|
+
import { buildDeleteEnvironmentTool, buildValidatedDeleteEnvironmentTool } from './deleteEnvironment.js';
|
|
10
|
+
import { buildGetCredentialTool, buildValidatedGetCredentialTool } from './getCredential.js';
|
|
11
|
+
import { buildUpdateCredentialTool, buildValidatedUpdateCredentialTool } from './updateCredential.js';
|
|
12
|
+
import { buildDeleteCredentialTool, buildValidatedDeleteCredentialTool } from './deleteCredential.js';
|
|
13
|
+
import { buildGetProjectTool, buildValidatedGetProjectTool } from './getProject.js';
|
|
14
|
+
import { buildUpdateProjectTool, buildValidatedUpdateProjectTool } from './updateProject.js';
|
|
15
|
+
import { buildDeleteProjectTool, buildValidatedDeleteProjectTool } from './deleteProject.js';
|
|
16
|
+
import { buildListExecutionsTool, buildValidatedListExecutionsTool } from './listExecutions.js';
|
|
17
|
+
import { buildGetExecutionTool, buildValidatedGetExecutionTool } from './getExecution.js';
|
|
18
|
+
import { buildCancelExecutionTool, buildValidatedCancelExecutionTool } from './cancelExecution.js';
|
|
2
19
|
let _tools = null;
|
|
3
20
|
let _validatedTools = null;
|
|
4
21
|
const toolRegistry = new Map();
|
|
@@ -6,12 +23,51 @@ const toolRegistry = new Map();
|
|
|
6
23
|
* Initialize tools with project context (call once after resolveProjectContext).
|
|
7
24
|
*/
|
|
8
25
|
export function initTools(ctx) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
26
|
+
const tools = [
|
|
27
|
+
buildTestPageChangesTool(ctx),
|
|
28
|
+
buildListProjectsTool(),
|
|
29
|
+
buildListEnvironmentsTool(),
|
|
30
|
+
buildListCredentialsTool(),
|
|
31
|
+
buildCreateEnvironmentTool(),
|
|
32
|
+
buildCreateCredentialTool(),
|
|
33
|
+
buildGetEnvironmentTool(),
|
|
34
|
+
buildUpdateEnvironmentTool(),
|
|
35
|
+
buildDeleteEnvironmentTool(),
|
|
36
|
+
buildGetCredentialTool(),
|
|
37
|
+
buildUpdateCredentialTool(),
|
|
38
|
+
buildDeleteCredentialTool(),
|
|
39
|
+
buildGetProjectTool(),
|
|
40
|
+
buildUpdateProjectTool(),
|
|
41
|
+
buildDeleteProjectTool(),
|
|
42
|
+
buildListExecutionsTool(),
|
|
43
|
+
buildGetExecutionTool(),
|
|
44
|
+
buildCancelExecutionTool(),
|
|
45
|
+
];
|
|
46
|
+
const validated = [
|
|
47
|
+
buildValidatedTestPageChangesTool(ctx),
|
|
48
|
+
buildValidatedListProjectsTool(),
|
|
49
|
+
buildValidatedListEnvironmentsTool(),
|
|
50
|
+
buildValidatedListCredentialsTool(),
|
|
51
|
+
buildValidatedCreateEnvironmentTool(),
|
|
52
|
+
buildValidatedCreateCredentialTool(),
|
|
53
|
+
buildValidatedGetEnvironmentTool(),
|
|
54
|
+
buildValidatedUpdateEnvironmentTool(),
|
|
55
|
+
buildValidatedDeleteEnvironmentTool(),
|
|
56
|
+
buildValidatedGetCredentialTool(),
|
|
57
|
+
buildValidatedUpdateCredentialTool(),
|
|
58
|
+
buildValidatedDeleteCredentialTool(),
|
|
59
|
+
buildValidatedGetProjectTool(),
|
|
60
|
+
buildValidatedUpdateProjectTool(),
|
|
61
|
+
buildValidatedDeleteProjectTool(),
|
|
62
|
+
buildValidatedListExecutionsTool(),
|
|
63
|
+
buildValidatedGetExecutionTool(),
|
|
64
|
+
buildValidatedCancelExecutionTool(),
|
|
65
|
+
];
|
|
66
|
+
_tools = tools;
|
|
67
|
+
_validatedTools = validated;
|
|
13
68
|
toolRegistry.clear();
|
|
14
|
-
|
|
69
|
+
for (const v of validated)
|
|
70
|
+
toolRegistry.set(v.name, v);
|
|
15
71
|
}
|
|
16
72
|
export function getTools() {
|
|
17
73
|
if (!_tools)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ListCredentialsInputSchema } from '../types/index.js';
|
|
2
|
+
import { listCredentialsHandler } from '../handlers/listCredentialsHandler.js';
|
|
3
|
+
const DESCRIPTION = `List credentials for a DebuggAI project. By default targets the project resolved from the current git repo. Optional environmentId filters to a single environment. Optional q filters by label or username. Optional role filters for exact match (server-side). Optional projectUuid overrides the auto-detected project. Never returns passwords or secret values.`;
|
|
4
|
+
export function buildListCredentialsTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'list_credentials',
|
|
7
|
+
title: 'List Project Credentials',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
environmentId: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Optional: filter credentials to a single environment UUID.',
|
|
15
|
+
},
|
|
16
|
+
projectUuid: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Optional: UUID of the target project. Defaults to the project resolved from the current git repo.',
|
|
19
|
+
},
|
|
20
|
+
q: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Optional: filter by label or username (case-insensitive substring).',
|
|
23
|
+
},
|
|
24
|
+
role: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Optional: filter by exact role match (e.g. "admin", "guest").',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function buildValidatedListCredentialsTool() {
|
|
34
|
+
const tool = buildListCredentialsTool();
|
|
35
|
+
return {
|
|
36
|
+
...tool,
|
|
37
|
+
inputSchema: ListCredentialsInputSchema,
|
|
38
|
+
handler: listCredentialsHandler,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ListEnvironmentsInputSchema } from '../types/index.js';
|
|
2
|
+
import { listEnvironmentsHandler } from '../handlers/listEnvironmentsHandler.js';
|
|
3
|
+
const DESCRIPTION = `List environments for a DebuggAI project. By default targets the project resolved from the current git repo; pass projectUuid to target a different project (get UUIDs via list_projects). Optional q filters by environment name via the backend search. Returns each environment's uuid, name, url, and isActive flag.`;
|
|
4
|
+
export function buildListEnvironmentsTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'list_environments',
|
|
7
|
+
title: 'List Project Environments',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
projectUuid: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Optional: UUID of the project to query. Defaults to the project resolved from the current git repo.',
|
|
15
|
+
},
|
|
16
|
+
q: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Optional: filter environments by name (server-side search).',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function buildValidatedListEnvironmentsTool() {
|
|
26
|
+
const tool = buildListEnvironmentsTool();
|
|
27
|
+
return {
|
|
28
|
+
...tool,
|
|
29
|
+
inputSchema: ListEnvironmentsInputSchema,
|
|
30
|
+
handler: listEnvironmentsHandler,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ListExecutionsInputSchema } from '../types/index.js';
|
|
2
|
+
import { listExecutionsHandler } from '../handlers/listExecutionsHandler.js';
|
|
3
|
+
const DESCRIPTION = `List workflow execution history. Optional status filter (e.g. "completed", "running", "failed", "cancelled") passed to backend ?status=. Optional limit caps the page size (default 10). Returns {count, executions:[{uuid,workflow,status,mode,source,outcome,startedAt,completedAt,durationMs,timestamp}]} — summary shape only. Use get_execution for full detail on a single uuid.`;
|
|
4
|
+
export function buildListExecutionsTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'list_executions',
|
|
7
|
+
title: 'List Workflow Executions',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
status: { type: 'string', description: 'Optional: filter by execution status.' },
|
|
13
|
+
limit: { type: 'number', description: 'Optional: page size cap.', minimum: 1, maximum: 200 },
|
|
14
|
+
},
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function buildValidatedListExecutionsTool() {
|
|
20
|
+
const tool = buildListExecutionsTool();
|
|
21
|
+
return { ...tool, inputSchema: ListExecutionsInputSchema, handler: listExecutionsHandler };
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ListProjectsInputSchema } from '../types/index.js';
|
|
2
|
+
import { listProjectsHandler } from '../handlers/listProjectsHandler.js';
|
|
3
|
+
const DESCRIPTION = `List DebuggAI projects accessible to the current API key. Optional "q" input filters by project name or repo name (passed through to the backend search). Returns uuid, name, slug, and repo for each project. Use this when you don't know which project to target or when the current git repo doesn't resolve to a DebuggAI project.`;
|
|
4
|
+
export function buildListProjectsTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'list_projects',
|
|
7
|
+
title: 'List DebuggAI Projects',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
q: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Optional search query to filter projects by name or repo name.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function buildValidatedListProjectsTool() {
|
|
22
|
+
const tool = buildListProjectsTool();
|
|
23
|
+
return {
|
|
24
|
+
...tool,
|
|
25
|
+
inputSchema: ListProjectsInputSchema,
|
|
26
|
+
handler: listProjectsHandler,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UpdateCredentialInputSchema } from '../types/index.js';
|
|
2
|
+
import { updateCredentialHandler } from '../handlers/updateCredentialHandler.js';
|
|
3
|
+
const DESCRIPTION = `Patch a credential by UUID. Optional fields: label, username, password, role. Password is write-only — set it to rotate, but it is never returned in any response. Requires environmentId. Returns {updated:true, credential:{...}}.`;
|
|
4
|
+
export function buildUpdateCredentialTool() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'update_credential',
|
|
7
|
+
title: 'Update Credential',
|
|
8
|
+
description: DESCRIPTION,
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
uuid: { type: 'string', description: 'UUID of the credential. Required.' },
|
|
13
|
+
environmentId: { type: 'string', description: 'UUID of the environment the cred belongs to. Required.' },
|
|
14
|
+
label: { type: 'string', description: 'Optional: new label.', minLength: 1 },
|
|
15
|
+
username: { type: 'string', description: 'Optional: new username.', minLength: 1 },
|
|
16
|
+
password: { type: 'string', description: 'Optional: new password (write-only — never echoed).', minLength: 1 },
|
|
17
|
+
role: { type: 'string', description: 'Optional: new role (note: backend currently drops role, see bead hpo).', minLength: 1 },
|
|
18
|
+
projectUuid: { type: 'string', description: 'Optional: project UUID. Defaults to git-auto-detect.' },
|
|
19
|
+
},
|
|
20
|
+
required: ['uuid', 'environmentId'],
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function buildValidatedUpdateCredentialTool() {
|
|
26
|
+
const tool = buildUpdateCredentialTool();
|
|
27
|
+
return { ...tool, inputSchema: UpdateCredentialInputSchema, handler: updateCredentialHandler };
|
|
28
|
+
}
|