Skip to content

Commit 4db2e83

Browse files
committed
chore: address PR comments and fix build on mcp-deploy-tools
- Export TARGETS from src/deploy/index.ts to avoid duplication. - Fix any usages in deploy.ts and deploy_status.ts. - Add index signature to Job interface in jobs.ts. - Fix lint warnings and errors.
1 parent 72d1a7b commit 4db2e83

4 files changed

Lines changed: 17 additions & 24 deletions

File tree

src/deploy/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
deployStatsParams,
3434
} from "./dataconnect/context";
3535

36-
const TARGETS = {
36+
export const TARGETS = {
3737
hosting: HostingTarget,
3838
database: DatabaseTarget,
3939
firestore: FirestoreTarget,

src/mcp/tools/core/deploy.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from "zod";
22
import { tool } from "../../tool";
3-
import { deploy as coreDeploy } from "../../../deploy";
3+
import { deploy as coreDeploy, TARGETS, DeployOptions } from "../../../deploy";
44
import { toContent, applyAppMeta } from "../../util";
55
import { jobTracker } from "../../util/jobs";
66

@@ -28,18 +28,7 @@ export const deploy = tool(
2828
},
2929
},
3030
async ({ only }, ctx) => {
31-
const validTargets = [
32-
"database",
33-
"storage",
34-
"firestore",
35-
"functions",
36-
"hosting",
37-
"remoteconfig",
38-
"extensions",
39-
"dataconnect",
40-
"apphosting",
41-
"auth",
42-
];
31+
const validTargets = Object.keys(TARGETS);
4332
let targets = validTargets;
4433
if (only) {
4534
const parts = only.split(",").map((p) => p.trim());
@@ -49,7 +38,7 @@ export const deploy = tool(
4938
const jobId = Date.now().toString();
5039
jobTracker.createJob(jobId);
5140

52-
const options: any = {
41+
const options = {
5342
only: only || "",
5443
except: "",
5544
filteredTargets: targets,
@@ -58,7 +47,7 @@ export const deploy = tool(
5847
rc: ctx.rc,
5948
config: ctx.config,
6049
nonInteractive: true,
61-
onProgress: (progress: any) => {
50+
onProgress: (progress: { phase: string; targets?: string[] }) => {
6251
const phaseNumbers: Record<string, number> = {
6352
predeploy: 10,
6453
prepare: 30,
@@ -70,19 +59,22 @@ export const deploy = tool(
7059
jobTracker.updateJob(jobId, { progress: percentage });
7160
jobTracker.addLog(
7261
jobId,
73-
`Deploy [${progress.phase}]: Complete for targets ${progress.targets?.join(",")}`,
62+
`Deploy [${progress.phase}]: Complete for targets ${(progress.targets || []).join(",")}`,
7463
);
7564
},
7665
};
7766

7867
// Run in background
79-
(async () => {
68+
void (async () => {
8069
try {
81-
const typedTargets = targets as any; // Cast or specify exact enum
82-
const res = await coreDeploy(typedTargets, options);
70+
const res = await coreDeploy(
71+
targets as (keyof typeof TARGETS)[],
72+
options as unknown as DeployOptions,
73+
);
8374
jobTracker.updateJob(jobId, { status: "success", progress: 100, result: res });
84-
} catch (err: any) {
85-
jobTracker.updateJob(jobId, { status: "failed", error: err.message });
75+
} catch (err: unknown) {
76+
const message = err instanceof Error ? err.message : String(err);
77+
jobTracker.updateJob(jobId, { status: "failed", error: message });
8678
}
8779
})();
8880

src/mcp/tools/core/deploy_status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const deploy_status = tool(
2020
requiresProject: true,
2121
},
2222
},
23-
async ({ jobId }, ctx) => {
23+
async ({ jobId }) => {
2424
const job = jobTracker.getJob(jobId);
2525
if (!job) {
2626
return mcpError(`Job not found: ${jobId}`);
@@ -31,7 +31,7 @@ export const deploy_status = tool(
3131
);
3232
return {
3333
...contentRes,
34-
structuredContent: job as any,
34+
structuredContent: job,
3535
};
3636
},
3737
);

src/mcp/util/jobs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface Job {
44
logs: string[];
55
result?: any;
66
error?: string;
7+
[key: string]: unknown;
78
}
89

910
class JobTracker {

0 commit comments

Comments
 (0)