Skip to content

Commit cf2e569

Browse files
committed
remove unused code
1 parent fd35ab8 commit cf2e569

File tree

6 files changed

+7
-294
lines changed

6 files changed

+7
-294
lines changed

packages/mcp-provider-devops/src/commitWorkItem.ts

Lines changed: 0 additions & 178 deletions
This file was deleted.

packages/mcp-provider-devops/src/getWorkItems.ts

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -122,53 +122,8 @@ export async function fetchWorkItems(connection: Connection, projectId: string):
122122
}
123123

124124
/**
125-
* Fetches a work item by name using an existing Connection (e.g. from getOrgService().getConnection()).
126-
* Use this when the caller already has a connection to avoid resolving it twice.
125+
* Fetches a work item by name using the given Connection (e.g. from getOrgService().getConnection()).
127126
*/
128-
export async function fetchWorkItemByNameWithConnection(
129-
connection: Connection,
130-
workItemName: string
131-
): Promise<WorkItem | null | any> {
132-
try {
133-
const query = `
134-
SELECT
135-
Id,
136-
Name,
137-
Subject,
138-
Description,
139-
Status,
140-
AssignedToId,
141-
SourceCodeRepositoryBranchId,
142-
SourceCodeRepositoryBranch.Name,
143-
SourceCodeRepositoryBranch.SourceCodeRepositoryId,
144-
SourceCodeRepositoryBranch.SourceCodeRepository.Name,
145-
SourceCodeRepositoryBranch.SourceCodeRepository.RepositoryOwner,
146-
SourceCodeRepositoryBranch.SourceCodeRepository.Provider,
147-
DevopsPipelineStageId,
148-
DevopsProjectId
149-
FROM WorkItem
150-
WHERE Name = '${workItemName}'
151-
LIMIT 1
152-
`;
153-
154-
const result: any = await connection.query(query);
155-
const item = (result?.records || [])[0];
156-
if (!item) {
157-
return null;
158-
}
159-
160-
const projectId: string = item?.DevopsProjectId;
161-
const cache = new Map<string, ProjectStagesContext>();
162-
const ctx = await ensureProjectStages(connection, cache, projectId);
163-
if (!ctx) {
164-
throw new Error(`Pipeline or stages not found for project: ${projectId}`);
165-
}
166-
return mapRawItemToWorkItem(item, ctx);
167-
} catch (error) {
168-
throw error;
169-
}
170-
}
171-
172127
export async function fetchWorkItemByName(connection: Connection, workItemName: string): Promise<WorkItem | null | any> {
173128
try {
174129
const query = `

packages/mcp-provider-devops/src/tools/createPullRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from "zod";
22
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import { McpTool, McpToolConfig, ReleaseState, Toolset, Services } from "@salesforce/mcp-provider-api";
44
import { createPullRequest } from "../createPullRequest.js";
5-
import { fetchWorkItemByNameWithConnection } from "../getWorkItems.js";
5+
import { fetchWorkItemByName } from "../getWorkItems.js";
66
import { usernameOrAliasParam } from "../shared/params.js";
77

88
const inputSchema = z.object({
@@ -88,7 +88,7 @@ export class CreatePullRequest extends McpTool<InputArgsShape, OutputArgsShape>
8888
};
8989
}
9090
const connection = await this.services.getOrgService().getConnection(input.usernameOrAlias);
91-
const workItem = await fetchWorkItemByNameWithConnection(connection, input.workItemName);
91+
const workItem = await fetchWorkItemByName(connection, input.workItemName);
9292

9393
if (!workItem || !workItem.id) {
9494
return {

packages/mcp-provider-devops/src/tools/sfDevopsPromoteWorkItem.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ export class SfDevopsPromoteWorkItem extends McpTool<InputArgsShape, OutputArgsS
8080

8181
public async exec(input: InputArgs): Promise<CallToolResult> {
8282
const startTime = Date.now();
83+
const connection = await this.services.getOrgService().getConnection(input.usernameOrAlias);
8384
let items: any[] | any;
84-
85+
8586
try {
86-
const connection = await this.services.getOrgService().getConnection(input.usernameOrAlias);
8787
items = await fetchWorkItemsByNames(connection, input.workItemNames);
8888
} catch (e: any) {
8989
const executionTime = Date.now() - startTime;
@@ -118,7 +118,6 @@ export class SfDevopsPromoteWorkItem extends McpTool<InputArgsShape, OutputArgsS
118118
}
119119

120120
try {
121-
const connection = await this.services.getOrgService().getConnection(input.usernameOrAlias);
122121
const result = await promoteWorkItems(connection, { workitems: prepared });
123122

124123
const executionTime = Date.now() - startTime;

packages/mcp-provider-devops/src/updateWorkItemStatus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type Connection } from "@salesforce/core";
2-
import { fetchWorkItemByNameWithConnection } from "./getWorkItems.js";
2+
import { fetchWorkItemByName } from "./getWorkItems.js";
33

44
export type WorkItemStatus = "In Progress" | "Ready to Promote";
55

@@ -31,7 +31,7 @@ export async function updateWorkItemStatus(
3131
workItemName: string,
3232
status: WorkItemStatus
3333
): Promise<UpdateWorkItemStatusResult> {
34-
const workItem = await fetchWorkItemByNameWithConnection(connection, workItemName);
34+
const workItem = await fetchWorkItemByName(connection, workItemName);
3535
if (!workItem?.id) {
3636
return {
3737
success: false,

packages/mcp-provider-devops/test/commitWorkItem.test.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)